【问题标题】:Google App Engine with Spring Roo带有 Spring Roo 的 Google App Engine
【发布时间】:2012-06-28 15:56:19
【问题描述】:

这是我正在运行的 Roo 脚本。在终端和 STS 中使用 shell 的 spring-roo-1.2.2.RELEASE 版本。

persistence setup --provider DATANUCLEUS --database GOOGLE_APP_ENGINE --applicationId roo-gae

entity jpa --class ~.domain.Wheel --testAutomatically
field string --fieldName code --notNull --unique

entity jpa --class ~.domain.Car --testAutomatically
field string --fieldName name --notNull --unique
field string --fieldName color --notNull
field reference --fieldName wheel --type ~.domain.Wheel --notNull

perform tests

我没有对项目进行任何手动更改,但执行测试失败并显示以下消息:

[ERROR] Failed to execute goal org.datanucleus:maven-datanucleus-plugin:3.0.2:enhance (default) on project test: Error executing DataNucleus tool org.datanucleus.enhancer.DataNucleusEnhancer: InvocationTargetException: Plugin (Bundle) "org.datanucleus.enhancer" is already registered. Ensure you dont have multiple JAR versions of the same plugin in the classpath. The URL "file:/home/timh/.m2/repository/org/datanucleus/datanucleus-enhancer/3.1.0-m1/datanucleus-enhancer-3.1.0-m1.jar" is already registered, and you are trying to register an identical plugin located at URL "file:/home/timh/.m2/repository/org/datanucleus/datanucleus-enhancer/3.0.1/datanucleus-enhancer-3.0.1.jar." -> [Help 1]
[ERROR] .Car roo> 
[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] .Car roo> 
[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/MojoExecutionException

我在类路径上看到 datanucleus-enhancer-3.0.1.jar,但我认为插件正在下载 datanucleus-enhancer-3.1.0-m1.jar。有谁知道这个问题的解决方案或解决方法?

【问题讨论】:

    标签: google-app-engine spring-roo


    【解决方案1】:

    这可以通过手动指定 datanucleus 增强器插件版本来纠正,方法是在 pom.xml 中的 maven-datanucleus-plugin 的依赖项下添加以下内容。

    <dependency>
     <groupId>org.datanucleus</groupId>
     <artifactId>datanucleus-enhancer</artifactId>
     <version>3.1.0-m2</version>
    </dependency>
    

    添加后,您的最终 maven-dataanucleus-plugin 配置可能如下所示。

    <plugin>
    <groupId>org.datanucleus</groupId>
    <artifactId>maven-datanucleus-plugin</artifactId>
    <version>3.0.2</version>
    <configuration>
            <fork>false</fork>
            <log4jConfiguration>${basedir}/src/main/resources/log4j.properties</log4jConfiguration>
            <mappingIncludes>**/*.class</mappingIncludes>
            <verbose>true</verbose>
            <enhancerName>ASM</enhancerName>
            <api>JPA</api>
        <mappingExcludes>**/CustomRequestFactoryServlet.class, **/GaeAuthFilter.class</mappingExcludes>
    </configuration>
    <executions>
        <execution>
            <phase>compile</phase>
            <goals>
                <goal>enhance</goal>
            </goals>
        </execution>
    </executions>
    <dependencies>
        <dependency>
            <groupId>org.datanucleus</groupId>
            <artifactId>datanucleus-core</artifactId>
            <version>3.0.10</version>
        </dependency>
        <dependency>
            <groupId>org.datanucleus</groupId>
            <artifactId>datanucleus-enhancer</artifactId>
            <version>3.1.0-m2</version>
        </dependency>
        <dependency>
            <groupId>org.datanucleus</groupId>
            <artifactId>datanucleus-api-jpa</artifactId>
            <version>3.0.9</version>
        </dependency>
    </dependencies>
    </plugin>
    

    干杯。

    【讨论】:

      【解决方案2】:

      我通过将“运行时”的范围添加到 datanucleus-core maven 依赖项来纠正此问题。

      【讨论】:

      • 你为什么不使用范围'test'?
      • 因为在运行时需要它,我认为在编译时插件提供了另一个“Enhancer”类来增强 Datanucleus 类,它与这个 jar 提供的那个冲突。
      猜你喜欢
      • 2012-04-08
      • 2017-11-17
      • 2017-01-10
      • 2011-01-22
      • 1970-01-01
      • 2010-11-13
      • 1970-01-01
      • 2013-01-17
      • 2023-03-20
      相关资源
      最近更新 更多