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

6 comments on “Maven – source value 1.5 is obsolete and will be removed in a future release

  1. 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.
    Reply
    1. 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.

      Reply
  2. 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)

    Reply

Leave a Comment

Your email address will not be published. Required fields are marked *