InvocationTargetException: Plugin (Bundle) "org.datanucleus" is already registered
I am trying to follow the DataNucleus tutorial for JDO. I am using Maven and I have followed the instructions available here for the enhancer.
However, I am getting the following error:
[datanucleus:enhance]
Could not transfer metadata asm:asm/maven-metadata.xml from/to local.repository (file:../../local.repository/trunk): No connector available to access repository local.repository (file:../../local.repository/trunk) of type legacy using the available factories WagonRepositoryConnectorFactory
CP: C:\... \.m2\repository\org\datanucleus\maven-datanucleus-plugin\3.0.0-release\maven-datanucleus-plugin-3.0.0-release.jar
CP: C:\... \.m2\repository\org\datanucleus\datanucleus-core\3.0.2\datanucleus-core-3.0.2.jar
CP: C:\... \.m2\repository\org\datanucleus\datanucleus-enhancer\3.0.0-release\datanucleus-enhancer-3.0.0-release.jar
CP: C:\... \.m2\repository\javax\jdo\jdo-api\3.1-SNAPSHOT-20110926\jdo-api-3.1-SNAPSHOT-20110926.jar
CP: C:\... \.m2\repository\javax\transaction\transaction-api\1.1\transaction-api-1.1.jar
CP: C:\... \.m2\repository\org\apache\geronimo\specs\geronimo-jpa_2.0_spec\1.0\geronimo-jpa_2.0_spec-1.0.jar
CP: C:\... \.m2\repository\asm\asm\3.3.1\asm-3.3.1.jar
CP: C:\... \.m2\repository\org\codehaus\plexus\plexus-utils\1.2\plexus-utils-1.2.jar
CP: C:\... \.m2\repository\junit\junit\3.8.1\junit-3.8.1.jar
CP: C:\... \trunk\plasma\target\classes
CP: C:\... \.m2\repository\net\dwst\generics\1.2.0\generics-1.2.0.jar
CP: C:\... \.m2\repository\org\swinglabs\swing-layout\1.0.3\swing-layout-1.0.3.jar
CP: C:\... \.m2\repository\org\apache\maven\maven-plugin-api\2.0.8\maven-plugin-api-2.0.8.jar
CP: C:\... \.m2\repository\org\apache\maven\maven-project\2.0.8\maven-project-2.0.8.jar
CP: C:\... \.m2\repository\org\apache\maven\maven-settings\2.0.8\maven-settings-2.0.8.jar
CP: C:\... \.m2\repository\org\apache\maven\maven-profile\2.0.8\maven-profile-2.0.8.jar
CP: C:\... \.m2\repository\org\apache\maven\maven-model\2.0.8\maven-model-2.0.8.jar
CP: C:\... \.m2\repository\org\apache\maven\maven-artifact-manager\2.0.8\maven-artifact-manager-2.0.8.jar
CP: C:\... \.m2\repository\org\apache\maven\maven-repository-metadata\2.0.8\maven-repository-metadata-2.0.8.jar
CP: C:\... \.m2\repository\org\apache\maven\wagon\wagon-provider-api\1.0-beta-2\wagon-provider-api-1.0-beta-2.jar
CP: C:\... \.m2\repository\org\apache\maven\maven-plugin-registry\2.0.8\maven-plugin-registry-2.0.8.jar
CP: C:\... \.m2\repository\org\apache\maven\maven-artifact\2.0.8\maven-artifact-2.0.8.jar
CP: C:\... \.m2\repository\org\codehaus\plexus\plexus-container-default\1.0-alpha-9-stable-1\plexus-container-default-1.0-alpha-9-stable-1.jar
CP: C:\... \.m2\repository\classworlds\classworlds\1.1-alpha-2\classworlds-1.1-alpha-2.jar
CP: C:\... \.m2\repository\org\codehaus\plexus\plexus-utils\1.4.5\plexus-utils-1.4.5.jar
CP: C:\... \.m2\repository\com\h2database\h2\1.3.158\h2-1.3.158.jar
CP: C:\... \.m2\repository\org\jboss\netty\netty\3.2.4.Final\netty-3.2.4.Final.jar
CP: C:\... \.m2\repository\org\apache\commons\commons-math\2.2\commons-math-2.2.jar
CP: C:\... \.m2\repository\net\flat\flat\1.2.0\flat-1.2.0.jar
CP: C:\... \.m2\repository\com\pyx4me\proguard-maven-plugin\2.0.4\proguard-maven-plugin-2.0.4.jar
CP: C:\... \.m2\repository\ant\ant\1.6.5\ant-1.6.5.jar
CP: C:\... \.m2\repository\org\apache\maven\maven-archiver\2.3\maven-archiver-2.3.jar
CP: C:\... \.m2\repository\org\codehaus\plexus\plexus-archiver\1.0-alpha-9\plexus-archiver-1.0-alpha-9.jar
CP: C:\... \.m2\repository\org\codehaus\plexus\plexus-io\1.0-alpha-1\plexus-io-1.0-alpha-1.jar
CP: C:\... \.m2\repository\com\sun\codemodel\codemodel\2.4\codemodel-2.4.jar
CP: C:\... \.m2\repository\org\datanucleus\datanucleus-core\3.0.0-release\datanucleus-core-3.0.0-release.jar
CP: C:\... \.m2\repository\org\datanucleus\datanucleus-api-jdo\3.0.0-release\datanucleus-api-jdo-3.0.0-release.jar
CP: C:\... \.m2\repository\org\datanucleus\datanucleus-rdbms\3.0.0-release\datanucleus-rdbms-3.0.0-release.jar
CP: C:\... \.m2\repository\javax\jdo\jdo-api\3.0\jdo-api-3.0.jar
07-oct.-2011 18:01:05 org.datanucleus.enhancer.DataNucleusEnhancer <init>
INFO: DataNucleus Enhancer : Using ClassEnhancer "ASM" for API "JDO"
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 8.475s
Finished at: Fri Oct 07 18:01:05 CEST 2011
Final Memory: 12M/29M
------------------------------------------------------------------------
Failed to execute goal org.datanucleus:maven-datanucleus-plugin:3.0.0-release:enhance (default) on project plasma:
Error executing enhancer: InvocationTargetException: Plugin (Bundle) "org.datanucleus" is already registered.
Ensure you dont have multiple JAR versions of the same plugin in the classpath.
The URL "file:/C:/... /.m2/repository/org/datanucleus/datanucleus-core/3.0.2/datanucleus-core-3.0.2.jar" is already registered,
and you are trying to register an identical plugin located at URL "file:/C:/... /.m2/repository/org/datanucleus/datanucleus-core/3.0.0-release/datanucleus-core-3.0.0-release.jar." -> [Help 1]
Does anyone know how开发者_开发知识库 can I solve this one? What is the proper pom.xml
configuration to make this tutorial work with release 3.0.0-release
?
EDIT
Here is my pom.xml
:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.dwst</groupId>
<artifactId>datanucleus</artifactId>
<version>1.0.0</version>
<name>DataNucleus 1.0.0</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.source>1.6</project.build.source>
<project.build.target>1.6</project.build.target>
</properties>
<build>
<finalName>DataNucleus</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<!-- Source code target JDK version & encoding -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>${project.build.source}</source>
<target>${project.build.target}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.datanucleus</groupId>
<artifactId>maven-datanucleus-plugin</artifactId>
<version>3.0.0-release</version>
<configuration>
<log4jConfiguration>${basedir}/log4j.properties</log4jConfiguration>
<verbose>true</verbose>
<fork>false</fork>
<!-- props>${basedir}/datanucleus.properties</props -->
</configuration>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>3.0.0-release</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-api-jdo</artifactId>
<version>3.0.0-release</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-rdbms</artifactId>
<version>3.0.0-release</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>maven-datanucleus-plugin</artifactId>
<version>3.0.0-release</version>
</dependency>
<dependency>
<groupId>javax.jdo</groupId>
<artifactId>jdo-api</artifactId>
<version>3.0</version>
</dependency>
</dependencies>
</project>
After reading this, I found the solution:
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>3.0.0-release</version>
<scope>runtime</scope>
</dependency>
The core dependency scope should be made runtime
.
General POM answer. Simply write in your pom.xml 3.0.0-release so the versions are identical. I hope that is feasible.
精彩评论