maven报错:不再支持源选项 5。请使用 6 或更高版本。

问题描述

再构建某个项目的时候发生了异常

D:\software\jdk10\bin\java.exe "-Dmaven.multiModuleProjectDirectory=D:\workspace\idea with spring\cqs" "-Dmaven.home=D:\software\IntelliJ IDEA Community Edition\plugins\maven\lib\maven3" "-Dclassworlds.conf=D:\software\IntelliJ IDEA Community Edition\plugins\maven\lib\maven3\bin\m2.conf" "-javaagent:D:\software\IntelliJ IDEA Community Edition\lib\idea_rt.jar=60907:D:\software\IntelliJ IDEA Community Edition\bin" -Dfile.encoding=UTF-8 -classpath "D:\software\IntelliJ IDEA Community Edition\plugins\maven\lib\maven3\boot\plexus-classworlds-2.5.2.jar" org.codehaus.classworlds.Launcher -Didea.version=2018.2 clean compile package
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building CertQuerySystem Maven Webapp 3.2
[INFO] ------------------------------------------------------------------------
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-jar-plugin/2.4/maven-jar-plugin-2.4.pom
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-jar-plugin/2.4/maven-jar-plugin-2.4.pom (0 B at 0.0 KB/sec)
Downloading: http://maven.aliyun.com/nexus/content/groups/public/com/jfinal/jfinal/maven-metadata.xml
Downloaded: http://maven.aliyun.com/nexus/content/groups/public/com/jfinal/jfinal/maven-metadata.xml (668 B at 0.8 KB/sec)
Downloading: http://maven.aliyun.com/nexus/content/groups/public/com/jfinal/jfinal/2.3-SNAPSHOT/maven-metadata.xml
Downloading: http://maven.aliyun.com/nexus/content/groups/public/com/jfinal/jfinal/3.1-SNAPSHOT/maven-metadata.xml
Downloading: http://maven.aliyun.com/nexus/content/groups/public/com/jfinal/jfinal/3.2-SNAPSHOT/maven-metadata.xml
Downloading: http://maven.aliyun.com/nexus/content/groups/public/com/jfinal/jfinal/3.3-SNAPSHOT/maven-metadata.xml
Downloading: http://maven.aliyun.com/nexus/content/groups/public/com/jfinal/jfinal/3.4-SNAPSHOT/maven-metadata.xml
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ CertQuerySystem ---
[INFO] Deleting D:\workspace\idea with spring\cqs\target
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ CertQuerySystem ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ CertQuerySystem ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 17 source files to D:\workspace\idea with spring\cqs\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] 不再支持源选项 5。请使用 6 或更高版本。
[ERROR] 不再支持目标选项 1.5。请使用 1.6 或更高版本。
[INFO] 2 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.702 s
[INFO] Finished at: 2018-08-02T22:53:45+08:00
[INFO] Final Memory: 13M/50M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project CertQuerySystem: Compilation failure: Compilation failure:
[ERROR] 不再支持源选项 5。请使用 6 或更高版本。
[ERROR] 不再支持目标选项 1.5。请使用 1.6 或更高版本。
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Process finished with exit code 1

解决方案

pom.xml文件中增加maven编译的jdk版本设置,maven.compiler.source和maven.compiler.target,另外java.version最好也加上

     <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
        <java.version>1.8</java.version>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties> 

猜你喜欢

转载自blog.csdn.net/moshowgame/article/details/81369327
今日推荐