gpt4 book ai didi

maven - CompilerMojo#execute() 导致链接错误 (java.lang.NoSuchMethodError) 并且可能已过时

转载 作者:行者123 更新时间:2023-12-02 03:19:21 26 4
gpt4 key购买 nike

我已经搜索了 google 并查看了 StackOverflow 上的答案,但似乎无法解决此问题。我最近加入了这个项目并向 POM 添加了一些内容。作为 Maven 的相对新手,我没有理解这个问题,而且我看到的回应也没有得到澄清。我怀疑这是在项目中添加了 Groovy。我想使用 Groovy 和 Spock 进行测试(希望最终也能用于产品)。

[INFO] Using Groovy-Eclipse compiler to compile both Java and Groovy files
[FATAL ERROR] org.apache.maven.plugin.CompilerMojo#execute() caused a linkage error (java.lang.NoSuchMethodError) and may be out-of-date. Check the realms:
[FATAL ERROR] Plugin realm = app0.child-container[org.apache.maven.plugins:maven-compiler-plugin:2.0.2]
urls[0] = file:/C:/Users/bill.turner/.m2/repository/org/apache/maven/plugins/maven-compiler-plugin/2.0.2/maven-compiler-plugin-2.0.2.jar
urls[1] = file:/C:/Users/bill.turner/.m2/repository/org/codehaus/groovy/groovy-eclipse-compiler/2.7.0-01/groovy-eclipse-compiler-2.7.0-01.jar
urls[2] = file:/C:/Users/bill.turner/.m2/repository/org/codehaus/groovy/groovy-eclipse-batch/2.0.4-02/groovy-eclipse-batch-2.0.4-02.jar
urls[3] = file:/C:/Users/bill.turner/.m2/repository/org/codehaus/plexus/plexus-compiler-api/1.5.3/plexus-compiler-api-1.5.3.jar
urls[4] = file:/C:/Users/bill.turner/.m2/repository/org/codehaus/plexus/plexus-utils/1.0.4/plexus-utils-1.0.4.jar
urls[5] = file:/C:/Users/bill.turner/.m2/repository/org/codehaus/plexus/plexus-compiler-manager/1.5.3/plexus-compiler-manager-1.5.3.jar
urls[6] = file:/C:/Users/bill.turner/.m2/repository/org/codehaus/plexus/plexus-compiler-javac/1.5.3/plexus-compiler-javac-1.5.3.jar
[FATAL ERROR] Container realm = plexus.core
urls[0] = file:/C:/Users/bill.turner/apache-maven-2.2.1/lib/maven-2.2.1-uber.jar
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] org.codehaus.plexus.compiler.CompilerConfiguration.getDebugLevel()Ljava/lang/String;
[INFO] ------------------------------------------------------------------------
[INFO] Trace
java.lang.NoSuchMethodError: org.codehaus.plexus.compiler.CompilerConfiguration.getDebugLevel()Ljava/lang/String;
at org.codehaus.groovy.eclipse.compiler.GroovyEclipseCompiler.createCommandLine(GroovyEclipseCompiler.java:343)
at org.codehaus.groovy.eclipse.compiler.GroovyEclipseCompiler.compile(GroovyEclipseCompiler.java:218)
at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:493)
at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:114)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)

最佳答案

我找到了答案。我必须向 maven-compiler-plugin 添加一个版本。为其他可能遇到此问题的人回答我自己的问题。线索是http://jira.codehaus.org/browse/MSITE-233

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<!-- added version here -->
<version>2.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerId>groovy-eclipse-compiler</compilerId>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
<version>2.7.0-01</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-batch</artifactId>
<version>1.8.6-01</version>
</dependency>
</dependencies>
</plugin>

关于maven - CompilerMojo#execute() 导致链接错误 (java.lang.NoSuchMethodError) 并且可能已过时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12679014/

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