문제

Google App Engine 프로젝트와 함께 사용하기 위해 Datanucleus Enhancer를 설정하는 데 문제가 있습니다. Datanucleus eclipse 플러그인을 사용하면 모든 것이 잘 진행되지만 Maven 프로젝트에서는 이상한 충돌 버전 오류가 발생합니다.

내 POM에는 이러한 Datanucleus 참조가 있습니다.

<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가 Datanucleus-core-1.1.3.jar를 다운로드 해야하는 이유를 이해하지 못합니다.

나는 또한 datanucleus-core-1.1.3.jar가 등록되는 이유를 이해하지 못합니다 ...

어떤 아이디어? 미리 감사드립니다 ...

도움이 되었습니까?

해결책

DN M2 플러그인은 사용 가능한 DN Jars의 최신 버전을 가져와 작업을 수행해야합니다 (최신 사용 외에는 다른 현명한 방법이 없습니다). 코어의 플러그인 종속성을 지정하거나 응용 프로그램에서이를 지정하여 "Core"를 다른 버전으로 제한하려고합니다.

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

다른 팁

불행히도 대답은 주석에서 "숨겨진"것입니다.

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

그것은 나를 위해 일했다!

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>

그런 다음 핵 코어를 런타임 종속성으로 추가

<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>

읽고 나서 "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>

로컬 Maven 저장소에서 이전 버전의 Datanucleus를 지우면 문제가 해결됩니다.

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 릴리스 (http://mvnrepository.com/artifact/org.datanucleus/maven-datanucleus-plugin/3.1.0 reelease).

Maven-Datanucleus-Plugin 3.1.1의 경우 Datanucleus-Core 의존성의 버전 범위는 (3.0.99, 3.1.99), Maven-Datanucleus-Plugin 3.1.0 릴리스는 (3.0.99,)입니다. 오래된 버전의 Maven-Datanucleus-Plugin에 대해서는 최신 버전의 Datanucleus-Core를 자동으로 가져옵니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top