我已经搜索了谷歌并在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)
答案 0 :(得分:9)
我找到了答案。我不得不在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>
答案 1 :(得分:1)
我遇到了同样的问题,但后来我找到了非常简单的解决方案。
step1 - 从http://maven.apache.org/download.cgi下载欲望maven文件夹(我已经下载了Maven 2.2.1(Binary tar.gz))
step2 - 提取tar并将文件夹放到您想要的位置(即/ usr / lib /)
step3 - 更新你使用它的maven的路径(在我的例子中是.bashrc)
基本上问题是你的maven已损坏,你需要按照上述步骤解决它。 :)