【发布时间】:2019-08-01 10:36:50
【问题描述】:
我正在使用 jdk 11 和 maven 3.8.0。请在下面找到给定的 pom.xml。我收到错误
致命错误编译:无效标志:--release -> [帮助1]
关于如何解决此问题的任何建议?
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>11</release>
<encoding>UTF-8</encoding>
</configuration>
<dependencies>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>7.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
</build>
遇到错误
Aug 1 15:50:11 [WARNING] The requested profile "inttest" could not be activated because it does not exist.
Aug 1 15:50:11 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:testCompile (default-testCompile) on project some-service: Fatal error compiling: invalid flag: --release -> [Help 1]
Aug 1 15:50:11 [ERROR]
Aug 1 15:50:11 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
Aug 1 15:50:11 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
Aug 1 15:50:11 [ERROR]
Aug 1 15:50:11 [ERROR] For more information about the errors and possible solutions, please read the following articles:
Aug 1 15:50:11 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
【问题讨论】:
-
您是否使用 java 11 和 $JAVA_HOME 变量设置您的项目?
-
首先我建议使用最新版本的 maven-compiler-plugin (3.8.1) 此外,无效标志意味着您没有使用 JDK 11 进行构建或未正确设置 JAVA_HOME,如前所述。 ..不需要对 asm 的依赖...
-
@khmarbaise 问题已解决,谢谢
标签: maven maven-3 maven-plugin java-11