2

私は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とのバージョンを更新しようとしましたが、前の SO の質問gmaven-pluginで提案されているように 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
4

2 に答える 2

3

あなたが持っている正確なエラーは見ていませんが、Groovy 1.8.7、gmaven-plugin 1.4、および gmaven-runtime-1.8 の組み合わせが成功していることがわかりました。にこのバグの回避策として jansi を含めなければならなかったことに注意してくださいmvn groovy:shell

Groovy 1.8.7 を依存関係に追加します。

<dependencies>
    <dependency>
    <groupId>org.codehaus.groovy</groupId>
    <artifactId>groovy-all</artifactId>
    <version>1.8.7</version>
</dependency>

次に、プラグイン構成を追加します。

<build>
    <plugins>
        <plugin>
            <groupId>org.codehaus.gmaven</groupId>
            <artifactId>gmaven-plugin</artifactId>
            <version>1.4</version>
            <executions>
                <execution>
                    <goals>
                        <goal>generateStubs</goal>
                        <goal>compile</goal>
                        <goal>generateTestStubs</goal>
                        <goal>testCompile</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <providerSelection>1.8</providerSelection>
            </configuration>
            <dependencies>
                <dependency>
                  <groupId>org.codehaus.gmaven.runtime</groupId>
                  <artifactId>gmaven-runtime-1.8</artifactId>
                  <version>1.4</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.8.7</version>
                </dependency>
                <dependency>
                    <groupId>org.fusesource.jansi</groupId>
                    <artifactId>jansi</artifactId>
                    <version>1.9</version>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
</build>
于 2012-08-11T02:40:56.357 に答える