19

Google App Engine プロジェクトで使用する 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>

プロジェクトをビルドしようとすると、次のエラーが発生します。

スレッド「メイン」プラグイン (バンドル) の例外「org.datanucleus」は既に登録されています。
クラスパスに同じプラグインの複数の JAR バージョンが含まれていないことを確認してください。URL「file:/Users/drome/.m2/repository/org/datanucleus/datanucleus-core/1.1.0/**datanucleus-core-1.1.0.jar**」はすでに登録されており、 URL「file:/Users/drome/.m2/repository/org/datanucleus/datanucleus-core/1.1.3/**datanucleus-core-1.1.3.jar**」にある同一のプラグインを登録します。
org.datanucleus.exceptions.NucleusException: プラグイン (バンドル) "org.datanucleus" は既に登録されています。クラスパスに同じプラグインの複数の JAR バージョンが含まれていないことを確認してください。URL「file:/Users/drome/.m2/repository/org/datanucleus/datanucleus-core/1.1.0/datanucleus-core-1.1.0.jar」はすでに登録されており、同一のプラグインを登録しようとしていますURL「file:/Users/drome/.m2/repository/org/datanucleus/datanucleus-core/1.1.3/datanucleus-core-1.1.3.jar」にあります。
org.datanucleus.plugin.NonManagedPluginRegistry.registerBundle (NonManagedPluginRegistry.java:437) で
org.datanucleus.plugin.NonManagedPluginRegistry.registerBundle (NonManagedPluginRegistry.java:343) で
org.datanucleus.plugin.NonManagedPluginRegistry.registerExtensions (NonManagedPluginRegistry.java:227) で
)
org.datanucleus.plugin.NonManagedPluginRegistry.registerExtensionPoints(NonManagedPluginRegistry.jav) で
a:159)
org.datanucleus.plugin.PluginManager.registerExtensionPoints(PluginManager.java:82) で
org.datanucleus.OMFContext.(OMFContext.java:164) で
org.datanucleus.enhancer.DataNucleusEnhancer.(DataNucleusEnhancer.java:171) で
org.datanucleus.enhancer.DataNucleusEnhancer.(DataNucleusEnhancer.java:149) で
org.datanucleus.enhancer.DataNucleusEnhancer.main (DataNucleusEnhancer.java:1157) で

これはpom.xmlで参照されていないため、datanucleusがdatanucleus-core-1.1.3.jarをダウンロードするためにmavenを必要とした理由がわかりません

また、datanucleus-core-1.1.3.jar が登録されている理由もわかりません...

何か案は?前もって感謝します...

4

6 に答える 6

5

残念ながら、答えはコメントに「隠されている」です。

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

それは私のために働いた!

于 2009-06-07T12:38:27.490 に答える
2

Maven Gae プラグインのアーキタイプをテストしているときに、同じ問題に遭遇しました。

gae ランタイムの推移的な依存関係に除外を追加して修正しました

<!-- Google App Engine meta-package -->
        <dependency>
            <groupId>net.kindleit</groupId>
            <artifactId>gae-runtime</artifactId>
            <version>${gae.version}</version>
            <type>pom</type>
            <exclusions>
                <exclusion>
                    <groupId>com.google.appengine.orm</groupId>
                    <artifactId>datanucleus-core</artifactId>
                </exclusion>

            </exclusions>
        </dependency>

次に、nucleus コアをランタイム依存関係として追加します。

<dependency>
            <groupId>org.datanucleus</groupId>
            <artifactId>datanucleus-core</artifactId>
            <version>${datanucleus-core.version}</version>
            <scope>runtime</scope>
            <exclusions>
                <exclusion>
                    <groupId>javax.transaction</groupId>
                    <artifactId>transaction-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

gae プラグイン セクションをシンプルに保ちます。

<plugin>
                <groupId>org.datanucleus</groupId>
                <artifactId>maven-datanucleus-plugin</artifactId>
                <version>${maven-datanucleus-plugin.version}</version>
                <configuration>
                    <!--
                        Make sure this path contains your persistent classes!
                    -->
                    <mappingIncludes>**/model/*.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>
于 2010-11-19T16:19:23.647 に答える
2

「 Maven でプラグインの依存関係をオーバーライドする方法」を読んだ後、これを修正する別の方法を見つけました。これが私のPOMです:

<plugin>
  <groupId>org.datanucleus</groupId>
  <artifactId>maven-datanucleus-plugin</artifactId>
  <version>3.1.0-m3</version>
  <configuration>
    <verbose>true</verbose>
  </configuration>

  <executions>
    <execution>
      <phase>process-classes</phase>
      <goals>
        <goal>enhance</goal>
      </goals>
    </execution>
  </executions>

  <dependencies>
    <dependency>
      <groupId>org.datanucleus</groupId>
      <artifactId>datanucleus-core</artifactId>
      <version>3.0.4</version>
    </dependency>
  </dependencies>
</plugin>
于 2012-07-28T12:19:54.900 に答える
0

ローカルのMavenリポジトリから古いバージョンのdatanucleusをクリアすることも、問題を解決します。

于 2009-07-18T21:55:47.777 に答える
0

Maven-datanucleus-plugin は、バージョン 3.1.1 以降、利用可能な datanucleus-core の最新バージョンの取り込みを停止しました。

Maven-datanucleus-plugin 3.1.1 の POM ファイルの違いを確認してください ( http://repo1.maven.org/maven2/org/datanucleus/maven-datanucleus-plugin/3.1.1/maven-datanucleus-plugin-3.1 .1.pom ) および 3.1.0-release ( http://mvnrepository.com/artifact/org.datanucleus/maven-datanucleus-plugin/3.1.0-release )。

maven-datanucleus-plugin 3.1.1 の場合、datanucleus-core 依存関係のバージョン範囲は (3.0.99, 3.1.99) であり、maven-datanucleus-plugin 3.1.0-release の場合は (3.0.99, ) です。古いバージョンの maven-datanucleus-plugin も不思議ではありません。datanucleus-core の最新バージョンが自動的に取り込まれます。

于 2013-02-04T16:00:55.903 に答える