Maven 项目报出警告:Warning:java: source value 1.5 is obsolete and will be removed in a future release

When using Maven projects run the program, reported a warning

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
Warning:java: To suppress warnings about obsolete options, use -Xlint:-options.

This is because the Maven build environment is built jdk 1.5 version.
When using maven development projects, we will not use jdk IDEA set, but the use of the built-in Maven jdk compiler.
To use the newer version, we need to specify their own version.

Just add the pom file for the project
( <project> </project>label inside).

<project>

<build>
    <!--[...]-->
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
    </plugins>
    <!--[...]-->
</build>

</project>

So the next time you run the program when the warning will not be reported.

Published 15 original articles · won praise 1 · views 269

Guess you like

Origin blog.csdn.net/lyfGeek/article/details/104630158