maven - maven 3.8.0 :testCompile (default-testCompile) 在项目 App 上:致命错误编译:无效标志:--release -> [帮助 1]
问题描述
我正在使用 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
解决方案
当您使用<release>11</release>
Java 9 的命令行功能,但使用 Java 8 构建它时,通常会发生此错误。
mvn --version
应该给你
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /opt/maven
Java version: 11.0.7, vendor: Oracle Corporation, runtime: /home/.../.sdkman/candidates/java/11.0.7-open
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.8.10-200.fc32.x86_64", arch: "amd64", family: "unix" ```
推荐阅读
- c++ - alignas() 对 sizeof() 的影响 - 强制性的?
- python-3.x - 在 Sympy 中表示一个常量符号,使其不是 free_symbol
- android - React Native - Android - tabNavigator 内 stackNavigator 中的keyboardavoidingView 推动bottomTabBar(笨拙的行为)
- python - Python数学问题我的结果非常接近示例但机器人相同
- c - int i 在这个特定程序的 for 循环中(在 scanf 和 sum 中)做了什么?
- awk - 模式匹配/排除(awk/sed)
- flutter - 如何在文本选择工具栏中添加新选项
- wordpress -
链接中断代码在function.php(Polylang)中不起作用 - html - 我如何使用引导程序在输入框中添加按钮
- javascript - jQuery 和 HTML,如何在下拉切换菜单中使用本地存储