Main Tutorials

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

About Author

author image
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

Comments

Subscribe
Notify of
6 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
Erwan Leroux
5 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
1 year ago

Thank’s for help!

Pawan Patidar
3 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
2 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
2 years ago
Reply to  Andrew Yang

Thanks a lot man.