gpt4 book ai didi

maven - 由于 Surefire JDK 版本,mvn 测试失败?

转载 作者:行者123 更新时间:2023-12-04 14:27:14 26 4
gpt4 key购买 nike

我正在尝试在我的项目上运行 mvn test。项目本身编译并安装,但 man test 失败并显示以下输出:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18:test (default-test) on project udms-server: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.18:test failed: There was an error in the forked process
[ERROR] java.lang.UnsupportedClassVersionError: some/project/Event : Unsupported major.minor version 52.0
[ERROR] at java.lang.ClassLoader.defineClass1(Native Method)
[ERROR] at java.lang.ClassLoader.defineClass(Unknown Source)
[ERROR] at java.security.SecureClassLoader.defineClass(Unknown Source)
[ERROR] at java.net.URLClassLoader.defineClass(Unknown Source)
[ERROR] at java.net.URLClassLoader.access$100(Unknown Source)
[ERROR] at java.net.URLClassLoader$1.run(Unknown Source)
[ERROR] at java.net.URLClassLoader$1.run(Unknown Source)
[ERROR] at java.security.AccessController.doPrivileged(Native Method)
[ERROR] at java.net.URLClassLoader.findClass(Unknown Source)
[ERROR] at java.lang.ClassLoader.loadClass(Unknown Source)
[ERROR] at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
[ERROR] at java.lang.ClassLoader.loadClass(Unknown Source)
[ERROR] at java.lang.ClassLoader.defineClass1(Native Method)
[ERROR] at java.lang.ClassLoader.defineClass(Unknown Source)
[ERROR] at java.security.SecureClassLoader.defineClass(Unknown Source)
[ERROR] at java.net.URLClassLoader.defineClass(Unknown Source)
[ERROR] at java.net.URLClassLoader.access$100(Unknown Source)
[ERROR] at java.net.URLClassLoader$1.run(Unknown Source)
[ERROR] at java.net.URLClassLoader$1.run(Unknown Source)
[ERROR] at java.security.AccessController.doPrivileged(Native Method)
[ERROR] at java.net.URLClassLoader.findClass(Unknown Source)
[ERROR] at java.lang.ClassLoader.loadClass(Unknown Source)
[ERROR] at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
[ERROR] at java.lang.ClassLoader.loadClass(Unknown Source)
[ERROR] at org.apache.maven.surefire.util.DefaultScanResult.loadClass(DefaultScanResult.java:131)
[ERROR] at org.apache.maven.surefire.util.DefaultScanResult.applyFilter(DefaultScanResult.java:95)
[ERROR] at org.apache.maven.surefire.junit4.JUnit4Provider.scanClassPath(JUnit4Provider.java:194)
[ERROR] at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:92)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
[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/PluginExecutionException

我认为 some/project 是用 Java 8 编译的...所以我将我当前的项目更改为使用 Java 8 而不是 7。我倾向于认为这与以下问题有关:

Can't fix Unsupported major.minor version 52.0 even after fixing compatibility

Unsupported major.minor version 52.0

现在我完全卡住了:(

最佳答案

JVM 应在插件配置中明确设置。

  <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<jvm>${env.JAVA_HOME}/bin/java</jvm>
</configuration>
</plugin>

关于maven - 由于 Surefire JDK 版本,mvn 测试失败?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27439564/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com