我正在尝试mvn clean install
一个已经登陆我盘子的 Maven 项目,但是我遇到了一个异常,我认为这可能是由于 Groovy 的版本冲突,这就是我得到的:
Failed to execute goal org.codehaus.gmaven:gmaven-plugin:1.3:testCompile (default) on project maven-myproject-plugin: Execution default of goal org.codehaus.gmaven:gmaven-plugin:1.3:testCompile failed: A required class was missing while executing org.codehaus.gmaven:gmaven-plugin:1.3:testCompile: groovy/lang/Closure
-e
用标志跟踪:
Caused by: java.lang.NoClassDefFoundError: groovy/lang/Closure
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
at java.lang.Class.getDeclaredMethods(Class.java:1791)
at org.codehaus.groovy.vmplugin.v5.Java5.configureClassNode(Java5.java:318)
at org.codehaus.groovy.ast.ClassNode.lazyClassInit(ClassNode.java:263)
at org.codehaus.groovy.ast.ClassNode.getUnresolvedSuperClass(ClassNode.java:957)
at org.codehaus.groovy.ast.ClassNode.getUnresolvedSuperClass(ClassNode.java:952)
at org.codehaus.groovy.control.ResolveVisitor.checkCyclicInheritence(ResolveVisitor.java:1309)
at org.codehaus.groovy.control.ResolveVisitor.visitClass(ResolveVisitor.java:1286)
at org.codehaus.groovy.control.ResolveVisitor.startResolving(ResolveVisitor.java:148)
at org.codehaus.groovy.control.CompilationUnit$6.call(CompilationUnit.java:574)
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:814)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:511)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:487)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:464)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:448)
at org.codehaus.gmaven.runtime.v1_7.ClassCompilerFeature$ClassCompilerImpl.compile(ClassCompilerFeature.java:148)
at org.codehaus.gmaven.plugin.compile.AbstractCompileMojo.compile(AbstractCompileMojo.java:200)
at org.codehaus.gmaven.plugin.compile.AbstractCompileMojo.process(AbstractCompileMojo.java:164)
at org.codehaus.gmaven.plugin.ComponentMojoSupport.doExecute(ComponentMojoSupport.java:60)
at org.codehaus.gmaven.plugin.compile.TestCompileMojo.doExecute(TestCompileMojo.java:90)
at org.codehaus.gmaven.plugin.MojoSupport.execute(MojoSupport.java:69)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
... 20 more
Caused by: java.lang.ClassNotFoundException: groovy.lang.Closure
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:696)
at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:793)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 43 more
这些是我正在使用的相关插件:
org.apache.maven.plugins maven-compiler-plugin ${maven-compiler-plugin.version} 1.6 1.6 true
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.3</version>
<configuration>
<providerSelection>1.7</providerSelection>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.codehaus.gmaven.runtime</groupId>
<artifactId>gmaven-runtime-1.7</artifactId>
<version>1.3</version>
<exclusions>
<exclusion>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>1.7.5</version>
</dependency>
</dependencies>
</plugin>
我已经尝试更新groovy-all
和的版本gmaven-plugin
,并且我还尝试按照之前的 SO 问题中的建议设置 providerSelection
这是我的 Java/Maven 版本:
mvn -version
Apache Maven 3.0.4 (r1232337; 2012-01-17 08:44:56+0000)
Maven home: /Users/JElsey/Development/tools/apache-maven-3.0.4
Java version: 1.6.0_32, vendor: Apple Inc.
Java home: /Library/Java/JavaVirtualMachines/1.6.0_32-b05-420.jdk/Contents/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x", version: "10.7.4", arch: "x86_64", family: "mac"
关于可能导致这种情况的任何指示?
编辑1:
我已经尝试将 maven 降级到 2.2.1,并重新指向符号链接以确保它不会尝试使用 Apple 喜欢随附的预打包 3.0.4,如此处所述。
我还是过不去,我不知道...
[FATAL ERROR] Container realm = plexus.core
urls[0] = file:/Users/JElsey/Development/tools/apache-maven-2.2.1/lib/maven-2.2.1-uber.jar
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] groovy/lang/Closure
groovy.lang.Closure
[INFO] ------------------------------------------------------------------------
[INFO] Trace
java.lang.NoClassDefFoundError: groovy/lang/Closure
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
at java.lang.Class.getDeclaredMethods(Class.java:1791)
at org.codehaus.groovy.vmplugin.v5.Java5.configureClassNode(Java5.java:318)
at org.codehaus.groovy.ast.ClassNode.lazyClassInit(ClassNode.java:263)
at org.codehaus.groovy.ast.ClassNode.getUnresolvedSuperClass(ClassNode.java:957)
at org.codehaus.groovy.ast.ClassNode.getUnresolvedSuperClass(ClassNode.java:952)
at org.codehaus.groovy.control.ResolveVisitor.checkCyclicInheritence(ResolveVisitor.java:1309)
at org.codehaus.groovy.control.ResolveVisitor.visitClass(ResolveVisitor.java:1286)
at org.codehaus.groovy.control.ResolveVisitor.startResolving(ResolveVisitor.java:148)
at org.codehaus.groovy.control.CompilationUnit$6.call(CompilationUnit.java:574)
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:814)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:511)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:487)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:464)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:448)
at org.codehaus.gmaven.runtime.v1_7.ClassCompilerFeature$ClassCompilerImpl.compile(ClassCompilerFeature.java:148)
at org.codehaus.gmaven.plugin.compile.AbstractCompileMojo.compile(AbstractCompileMojo.java:200)
at org.codehaus.gmaven.plugin.compile.AbstractCompileMojo.process(AbstractCompileMojo.java:164)
at org.codehaus.gmaven.plugin.ComponentMojoSupport.doExecute(ComponentMojoSupport.java:60)
at org.codehaus.gmaven.plugin.compile.TestCompileMojo.doExecute(TestCompileMojo.java:90)
at org.codehaus.gmaven.plugin.MojoSupport.execute(MojoSupport.java:69)
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)
Caused by: java.lang.ClassNotFoundException: groovy.lang.Closure
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:696)
at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:793)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 41 more