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

使用maven报不再支持源选项 6。请使用 7 或更高版本。@TOC

"C:\Program Files\Java\jdk-12.0.1\bin\java.exe" -Dmaven.multiModuleProjectDirectory=F:\Java\springboot_01_start01 -Dmaven.home=F:\Maven02\apache-maven-3.3.9 -Dclassworlds.conf=F:\Maven02\apache-maven-3.3.9\bin\m2.conf -Didea.launcher.port=55119 "-Didea.launcher.bin.path=D:\360Downloads\IntelliJ IDEA 2018.2.4\bin" -Dfile.encoding=UTF-8 -classpath "F:\Maven02\apache-maven-3.3.9\boot\plexus-classworlds-2.5.2.jar;D:\360Downloads\IntelliJ IDEA 2018.2.4\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMainV2 org.codehaus.classworlds.Launcher -Didea.version=2018.2.4 -s F:\Maven02\apache-maven-3.3.9\conf\settings.xml package [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building springboot_01_start01 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ springboot_01_start01 --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 0 resource [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ springboot_01_start01 --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 2 source files to F:\Java\springboot_01_start01\target\classes [INFO] ------------------------------------------------------------- [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] 不再支持源选项 6。请使用 7 或更高版本。 [ERROR] 不再支持目标选项 6。请使用 7 或更高版本。 [INFO] 2 errors [INFO] ------------------------------------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.629 s [INFO] Finished at: 2020-06-25T22:16:39+08:00 [INFO] Final Memory: 15M/54M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project springboot_01_start01: Compilation failure: Compilation failure: [ERROR] 不再支持源选项 6。请使用 7 或更高版本。 [ERROR] 不再支持目标选项 6。请使用 7 或更高版本。 [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/MojoFailureExceptionb.io/)

我使用的Maven版本为3.3.9

解决方法:

在config seting.xml中修改jdk版本,将其改为自己电脑上面装的JDK版本,下面以JDK1.8为例。

<profile>
      <id>jdk-1.8</id>

      <activation>
        <jdk>1.8</jdk>
      </activation>

      <repositories>
        <repository>
          <id>jdk14</id>
          <name>Repository for JDK 1.8 builds</name>
          <url>http://www.myhost.com/maven/jdk14</url>
          <layout>default</layout>
          <snapshotPolicy>always</snapshotPolicy>
        </repository>
      </repositories>
    </profile>

最后成功解决了项目部署的问题:

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building springboot_01_start01 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ springboot_01_start01 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ springboot_01_start01 ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ springboot_01_start01 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory F:\Java\springboot_01_start01\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ springboot_01_start01 ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.18.1:test (default-test) @ springboot_01_start01 ---
[INFO] No tests to run.
[INFO] 
[INFO] --- maven-jar-plugin:2.6:jar (default-jar) @ springboot_01_start01 ---
[INFO] Building jar: F:\Java\springboot_01_start01\target\springboot_01_start01-1.0-SNAPSHOT.jar
[INFO] 
[INFO] --- spring-boot-maven-plugin:1.5.9.RELEASE:repackage (default) @ springboot_01_start01 ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.489 s
[INFO] Finished at: 2020-06-25T22:33:09+08:00
[INFO] Final Memory: 19M/67M
[INFO] ------------------------------------------------------------------------

你可能感兴趣的:(Maven)