google-app-engine - maven google app engine 项目中 datanucleus 增强器的冲突版本

标签 google-app-engine maven-2 datanucleus

我在设置 datanucleus 增强器以用于谷歌应用引擎项目时遇到问题。如果我使用 datanucleus eclipse 插件一切顺利,但在我的 maven 项目中我得到一个奇怪的版本冲突错误。

我的 POM 有这些数据核引用:

<dependency>
    <groupId>org.datanucleus</groupId>
    <artifactId>datanucleus-core</artifactId>
    <version>1.1.0</version>
</dependency>

...

<plugin>
    <groupId>org.datanucleus</groupId>
    <artifactId>maven-datanucleus-plugin</artifactId>
    <version>1.1.0</version>
    <configuration>
        <mappingIncludes>**/*.class</mappingIncludes>
        <verbose>true</verbose>
        <enhancerName>ASM</enhancerName>
        <api>JDO</api>
    </configuration>
    <executions>
        <execution>
        <phase>compile</phase>
        <goals>
            <goal>enhance</goal>
        </goals>
        </execution>
    </executions>
</plugin>

当我尝试构建项目时出现以下错误:

Exception in thread "main" Plugin (Bundle) "org.datanucleus" is already registered. 
Ensure you dont have multiple JAR versions of the same plugin in the classpath. The URL "file:/Users/drome/.m2/repository/org/datanucleus/datanucleus-core/1.1.0/**datanucleus-core-1.1.0.jar**" is already registered, and you are trying to register an identical plugin located at URL "file:/Users/drome/.m2/repository/org/datanucleus/datanucleus-core/1.1.3/**datanucleus-core-1.1.3.jar**."
org.datanucleus.exceptions.NucleusException: Plugin (Bundle) "org.datanucleus" is already registered. Ensure you dont have multiple JAR versions of the same plugin in the classpath. The URL "file:/Users/drome/.m2/repository/org/datanucleus/datanucleus-core/1.1.0/datanucleus-core-1.1.0.jar" is already registered, and you are trying to register an identical plugin located at URL "file:/Users/drome/.m2/repository/org/datanucleus/datanucleus-core/1.1.3/datanucleus-core-1.1.3.jar."
at org.datanucleus.plugin.NonManagedPluginRegistry.registerBundle(NonManagedPluginRegistry.java:437)
at org.datanucleus.plugin.NonManagedPluginRegistry.registerBundle(NonManagedPluginRegistry.java:343)
at org.datanucleus.plugin.NonManagedPluginRegistry.registerExtensions(NonManagedPluginRegistry.java:227
)
at org.datanucleus.plugin.NonManagedPluginRegistry.registerExtensionPoints(NonManagedPluginRegistry.jav
a:159)
at org.datanucleus.plugin.PluginManager.registerExtensionPoints(PluginManager.java:82)
at org.datanucleus.OMFContext.(OMFContext.java:164)
at org.datanucleus.enhancer.DataNucleusEnhancer.(DataNucleusEnhancer.java:171)
at org.datanucleus.enhancer.DataNucleusEnhancer.(DataNucleusEnhancer.java:149)
at org.datanucleus.enhancer.DataNucleusEnhancer.main(DataNucleusEnhancer.java:1157)

我不明白为什么 datanucleus 需要 maven 下载 datanucleus-core-1.1.3.jar,因为它没有在 pom.xml 中引用

我也不明白为什么要注册datanucleus-core-1.1.3.jar...

有什么想法吗? 提前致谢...

最佳答案

DN M2 插件会提取它完成工作所需的可用 DN jar 的最新版本(除了使用最新版本之外,没有其他明智的方法可以做到这一点)。你想限制“核心”到不同的版本,要么通过指定核心的插件依赖,要么在你的应用程序中指定它

<dependency>
    <groupId>org.datanucleus</groupId>
    <artifactId>datanucleus-core</artifactId>
    <version>1.1.0</version>
    <scope>runtime</scope> 
</dependency>

关于google-app-engine - maven google app engine 项目中 datanucleus 增强器的冲突版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/877949/

相关文章:

eclipse - 使用eclipse构建多个项目配置

java - JPA2 与 HBase 数据存储使用 Datanucleus 写入重复行

java - 无法将我的 GoogleAppEngine(GAE/J) 应用程序与 JPA (DataNucleus) 集成

java - DataNucleus:同时写入两个存储(RDBMS 和文件系统)?

python - 模块未找到错误 : No module named 'google.appengine'

java - 如何使用 Maven 构建 SWT 应用程序

google-app-engine - 如何在 IntelliJ 12 中创建一个新的 Google App Engine 项目?

maven - 使用 Maven 构建时出现服务不可用错误

python - 使用 catch all 捕获 url 不渲染 css

google-app-engine - 使用 Go 在 GAE 数据存储上嵌套结构