Maven – source value 1.5 is obsolete and will be removed in a future release

In IntelliJ IDEA, Maven builds a project, and hits the following warning message?


Warning:java: source value 1.5 is obsolete and will be removed in a future release
Warning:java: target value 1.5 is obsolete and will be removed in a future release

To fix it, add maven-compiler-plugin plugin.

pom.xml

	<build>
        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>

        </plugins>
    </build>

References

mkyong

Founder of Mkyong.com, passionate Java and open-source technologies. If you enjoy my tutorials, consider making a donation to these charities.

6 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
Erwan Leroux
7 years ago

That post doesn’t explain why the warning is shown and what the fix is doing.

The warning appear when the default configuration of the maven-compiler-plugin is used and the project is using another version of java.
To fix it, you have to specify the version of java you are using, with the parameters you mentioned (source and target)

Viktor
4 years ago

Thank’s for help!

Pawan Patidar
5 years ago

You can also resolve this problem by using below steps for Eclips user and can be work for IntelliJ as well-

  1. Right click on the project and select Buid Path then Configure Build Path..
  2. Select Project Facets under Maven.
  3. Then select Java version as 1.8 and apply ok.
Andrew Yang
4 years ago
Reply to  Pawan Patidar

I fix this issue by setting Project language level to 8 in File → Project Structure → Project → Project language level, and same in File → Settings → Build, Execution, Deployment, Compiler → Java Compiler → Target bytecode version.

Mariana Dinis
4 years ago
Reply to  Andrew Yang

Thanks a lot man.