Obviously the documentations are outdated and even having mistakes.
This is my POM file:
<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>mg.labs.jdo</groupId>
<artifactId>jdo-enhancement</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<name>jdo-enhancement</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-accessplatform-jdo-rdbms</artifactId>
<version>3.3.0-release</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-maven-plugin</artifactId>
<version>3.3.0-release</version>
<configuration>
<api>JDO</api>
<props>${basedir}/datanucleus.properties</props>
<log4jConfiguration>${basedir}/log4j.properties</log4jConfiguration>
<verbose>true</verbose>
</configuration>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
3.3.8
or 4.0.0.M2
instead ? Simply changing the numbers didn't work !Plugin execution not covered by lifecycle configuration: org.datanucleus:datanucleus-maven-plugin:3.3.0-release:enhance (execution: default, phase: process-classes)
Running the goals install
shows the following error:
Plugin (Bundle) "org.datanucleus" is already registered. Ensure you dont have multiple JAR versions of the same plugin in the classpath. The URL "file:/home/mgelbana/.m2/repository/org/datanucleus/datanucleus-core/3.2.5/datanucleus-core-3.2.5.jar" is already registered, and you are trying to register an identical plugin located at URL "file:/home/mgelbana/.m2/repository/org/datanucleus/datanucleus-core/4.0.0-m2/datanucleus-core-4.0.0-m2.jar."
Although I haven't included versions 3.2.5
nor 4.0.0-m2
. I wish I could be using the latest version but I don't know how, as I said, changing the version numbers doesn't work as expected.
My main goal is to run package and enhance the classes before packaging, which is just what the documentation tries to do. How to do that with the latest datanculeus release version ?
EDIT I debugged as Neil adviced, there is what I think is significant: (At the beginning, these lines indicate the dependencies for the included maven dependency)
[DEBUG] mg.labs.jdo:jdo-enhancement:jar:1.0
[DEBUG] org.datanucleus:datanucleus-accessplatform-jdo-rdbms:pom:3.3.0-release:compile
[DEBUG] javax.jdo:jdo-api:jar:3.0.1:compile
[DEBUG] javax.transaction:jta:jar:1.1:compile
[DEBUG] org.datanucleus:datanucleus-core:jar:3.2.5:compile
[DEBUG] org.datanucleus:datanucleus-api-jdo:jar:3.2.4:compile
[DEBUG] org.datanucleus:datanucleus-jdo-query:jar:3.0.2:compile
[DEBUG] org.datanucleus:datanucleus-rdbms:jar:3.2.4:compile
[DEBUG] junit:junit:jar:3.8.1:test
(These lines at the starts are the ones indicating some unexpected events for datanucleus plugin, such as not being able to download meta-data xml files and including datanucleus-core 4.0.0-m3
files, the successive lines are just a result of that faulty inclusion)
[INFO] --- datanucleus-maven-plugin:3.3.0-release:enhance (default) @ jdo-enhancement ---
[DEBUG] Could not find metadata org.datanucleus:datanucleus-core/maven-metadata.xml in local (/home/mgelbana/.m2/repository)
[DEBUG] Skipped remote update check for org.datanucleus:datanucleus-core/maven-metadata.xml, locally cached metadata up-to-date.
[DEBUG] Using connector WagonRepositoryConnector with priority 0.0 for http://www.datanucleus.org/downloads/maven2/
[DEBUG] Using connector WagonRepositoryConnector with priority 0.0 for https://oss.sonatype.org/content/repositories/snapshots
Downloading: https://oss.sonatype.org/content/repositories/snapshots/org/datanucleus/datanucleus-core/maven-metadata.xml
Downloading: http://www.datanucleus.org/downloads/maven2/org/datanucleus/datanucleus-core/maven-metadata.xml
[DEBUG] Writing tracking file /home/mgelbana/.m2/repository/org/datanucleus/datanucleus-core/resolver-status.properties
[DEBUG] Writing tracking file /home/mgelbana/.m2/repository/org/datanucleus/datanucleus-core/resolver-status.properties
[DEBUG] Could not find metadata org.datanucleus:datanucleus-core/maven-metadata.xml in DN_M2_Repo (http://www.datanucleus.org/downloads/maven2/)
[DEBUG] Could not find metadata org.datanucleus:datanucleus-core/maven-metadata.xml in sonatype-nexus-snapshots (https://oss.sonatype.org/content/repositories/snapshots)
[DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=0, ConflictMarker.markTime=0, ConflictMarker.nodeCount=41, ConflictIdSorter.graphTime=1, ConflictIdSorter.topsortTime=0, ConflictIdSorter.conflictIdCount=18, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=1, ConflictResolver.conflictItemCount=40, DefaultDependencyCollector.collectTime=6063, DefaultDependencyCollector.transformTime=2}
[DEBUG] org.datanucleus:datanucleus-maven-plugin:jar:3.3.0-release:
[DEBUG] org.datanucleus:datanucleus-core:jar:4.0.0-m3:runtime
[DEBUG] org.codehaus.plexus:plexus-utils:jar:3.0.8:compile
[DEBUG] org.apache.maven:maven-artifact:jar:3.0.4:compile
[DEBUG] org.apache.maven:maven-plugin-api:jar:3.0.4:compile
[DEBUG] org.apache.maven:maven-model:jar:3.0.4:compile
[DEBUG] org.sonatype.sisu:sisu-inject-plexus:jar:2.3.0:compile
[DEBUG] org.codehaus.plexus:plexus-component-annotations:jar:1.5.5:compile
[DEBUG] org.sonatype.sisu:sisu-inject-bean:jar:2.3.0:compile
[DEBUG] org.sonatype.sisu:sisu-guice:jar:no_aop:3.1.0:compile
[DEBUG] org.sonatype.sisu:sisu-guava:jar:0.9.9:compile
[DEBUG] org.codehaus.plexus:plexus-container-default:jar:1.5.5:compile
[DEBUG] org.codehaus.plexus:plexus-classworlds:jar:2.2.2:compile
[DEBUG] org.apache.xbean:xbean-reflect:jar:3.4:compile
[DEBUG] log4j:log4j:jar:1.2.12:compile
[DEBUG] commons-logging:commons-logging-api:jar:1.1:compile
[DEBUG] com.google.collections:google-collections:jar:1.0:compile
[DEBUG] junit:junit:jar:3.8.2:compile
[DEBUG] Created new class realm plugin>org.datanucleus:datanucleus-maven-plugin:3.3.0-release
[DEBUG] Importing foreign packages into class realm plugin>org.datanucleus:datanucleus-maven-plugin:3.3.0-release
[DEBUG] Imported: < maven.api
[DEBUG] Populating class realm plugin>org.datanucleus:datanucleus-maven-plugin:3.3.0-release
[DEBUG] Included: org.datanucleus:datanucleus-maven-plugin:jar:3.3.0-release
[DEBUG] Included: org.datanucleus:datanucleus-core:jar:4.0.0-m3
[DEBUG] Included: org.codehaus.plexus:plexus-utils:jar:3.0.8
[DEBUG] Included: org.codehaus.plexus:plexus-component-annotations:jar:1.5.5
[DEBUG] Included: org.sonatype.sisu:sisu-inject-bean:jar:2.3.0
[DEBUG] Included: org.sonatype.sisu:sisu-guice:jar:no_aop:3.1.0
[DEBUG] Included: org.sonatype.sisu:sisu-guava:jar:0.9.9
[DEBUG] Included: org.apache.xbean:xbean-reflect:jar:3.4
[DEBUG] Included: log4j:log4j:jar:1.2.12
[DEBUG] Included: commons-logging:commons-logging-api:jar:1.1
[DEBUG] Included: com.google.collections:google-collections:jar:1.0
[DEBUG] Included: junit:junit:jar:3.8.2
[DEBUG] Excluded: org.apache.maven:maven-artifact:jar:3.0.4
[DEBUG] Excluded: org.apache.maven:maven-plugin-api:jar:3.0.4
[DEBUG] Excluded: org.apache.maven:maven-model:jar:3.0.4
[DEBUG] Excluded: org.sonatype.sisu:sisu-inject-plexus:jar:2.3.0
[DEBUG] Excluded: org.codehaus.plexus:plexus-container-default:jar:1.5.5
[DEBUG] Excluded: org.codehaus.plexus:plexus-classworlds:jar:2.2.2
[DEBUG] Configuring mojo org.datanucleus:datanucleus-maven-plugin:3.3.0-release:enhance from plugin realm ClassRealm[plugin>org.datanucleus:datanucleus-maven-plugin:3.3.0-release, parent: sun.misc.Launcher$AppClassLoader@591ce4fe]
[DEBUG] Configuring mojo 'org.datanucleus:datanucleus-maven-plugin:3.3.0-release:enhance' with basic configurator -->
[DEBUG] (f) alwaysDetachable = false
[DEBUG] (f) api = JDO
[DEBUG] (f) classpathElements = [/home/mgelbana/workspace/kepler_maven_by_example/jdo-enhancement/target/classes, /home/mgelbana/.m2/repository/javax/jdo/jdo-api/3.0.1/jdo-api-3.0.1.jar, /home/mgelbana/.m2/repository/javax/transaction/jta/1.1/jta-1.1.jar, /home/mgelbana/.m2/repository/org/datanucleus/datanucleus-core/3.2.5/datanucleus-core-3.2.5.jar, /home/mgelbana/.m2/repository/org/datanucleus/datanucleus-api-jdo/3.2.4/datanucleus-api-jdo-3.2.4.jar, /home/mgelbana/.m2/repository/org/datanucleus/datanucleus-jdo-query/3.0.2/datanucleus-jdo-query-3.0.2.jar, /home/mgelbana/.m2/repository/org/datanucleus/datanucleus-rdbms/3.2.4/datanucleus-rdbms-3.2.4.jar]
[DEBUG] (f) detachListener = false
[DEBUG] (f) fork = true
[DEBUG] (f) generateConstructor = true
[DEBUG] (f) generatePK = true
[DEBUG] (f) log4jConfiguration = /home/mgelbana/workspace/kepler_maven_by_example/jdo-enhancement/log4j.properties
[DEBUG] (f) metadataDirectory = /home/mgelbana/workspace/kepler_maven_by_example/jdo-enhancement/target/classes
[DEBUG] (f) metadataIncludes = **/*.jdo, **/*.class
[DEBUG] (f) pluginArtifacts = [org.datanucleus:datanucleus-maven-plugin:maven-plugin:3.3.0-release:, org.datanucleus:datanucleus-core:jar:4.0.0-m3:runtime, org.codehaus.plexus:plexus-utils:jar:3.0.8:compile, org.codehaus.plexus:plexus-component-annotations:jar:1.5.5:compile, org.sonatype.sisu:sisu-inject-bean:jar:2.3.0:compile, org.sonatype.sisu:sisu-guice:jar:no_aop:3.1.0:compile, org.sonatype.sisu:sisu-guava:jar:0.9.9:compile, org.apache.xbean:xbean-reflect:jar:3.4:compile, log4j:log4j:jar:1.2.12:compile, commons-logging:commons-logging-api:jar:1.1:compile, com.google.collections:google-collections:jar:1.0:compile, junit:junit:jar:3.8.2:compile]
[DEBUG] (f) quiet = false
[DEBUG] (f) verbose = true
[DEBUG] -- end configuration --
[DEBUG] Metadata Directory is : /home/mgelbana/workspace/kepler_maven_by_example/jdo-enhancement/target/classes
[DEBUG] Executing command line:
[DEBUG] /bin/sh -c java -cp /home/mgelbana/.m2/repository/org/datanucleus/datanucleus-maven-plugin/3.3.0-release/datanucleus-maven-plugin-3.3.0-release.jar:/home/mgelbana/.m2/repository/org/datanucleus/datanucleus-core/4.0.0-m3/datanucleus-core-4.0.0-m3.jar:/home/mgelbana/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.8/plexus-utils-3.0.8.jar:/home/mgelbana/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar:/home/mgelbana/.m2/repository/org/sonatype/sisu/sisu-inject-bean/2.3.0/sisu-inject-bean-2.3.0.jar:/home/mgelbana/.m2/repository/org/sonatype/sisu/sisu-guice/3.1.0/sisu-guice-3.1.0-no_aop.jar:/home/mgelbana/.m2/repository/org/sonatype/sisu/sisu-guava/0.9.9/sisu-guava-0.9.9.jar:/home/mgelbana/.m2/repository/org/apache/xbean/xbean-reflect/3.4/xbean-reflect-3.4.jar:/home/mgelbana/.m2/repository/log4j/log4j/1.2.12/log4j-1.2.12.jar:/home/mgelbana/.m2/repository/commons-logging/commons-logging-api/1.1/commons-logging-api-1.1.jar:/home/mgelbana/.m2/repository/com/google/collections/google-collections/1.0/google-collections-1.0.jar:/home/mgelbana/.m2/repository/junit/junit/3.8.2/junit-3.8.2.jar:/home/mgelbana/workspace/kepler_maven_by_example/jdo-enhancement/target/classes:/home/mgelbana/.m2/repository/javax/jdo/jdo-api/3.0.1/jdo-api-3.0.1.jar:/home/mgelbana/.m2/repository/javax/transaction/jta/1.1/jta-1.1.jar:/home/mgelbana/.m2/repository/org/datanucleus/datanucleus-core/3.2.5/datanucleus-core-3.2.5.jar:/home/mgelbana/.m2/repository/org/datanucleus/datanucleus-api-jdo/3.2.4/datanucleus-api-jdo-3.2.4.jar:/home/mgelbana/.m2/repository/org/datanucleus/datanucleus-jdo-query/3.0.2/datanucleus-jdo-query-3.0.2.jar:/home/mgelbana/.m2/repository/org/datanucleus/datanucleus-rdbms/3.2.4/datanucleus-rdbms-3.2.4.jar -Dlog4j.configuration=file:/home/mgelbana/workspace/kepler_maven_by_example/jdo-enhancement/log4j.properties org.datanucleus.enhancer.DataNucleusEnhancer -v -api JDO /home/mgelbana/workspace/kepler_maven_by_example/jdo-enhancement/target/classes/mg/labs/jdo/enhancement/App.class /home/mgelbana/workspace/kepler_maven_by_example/jdo-enhancement/target/classes/mg/labs/jdo/enhancement/QApp.class
[DEBUG] Exit code: 1
[DEBUG] --------------------
[DEBUG] Standard output from the DataNucleus tool org.datanucleus.enhancer.DataNucleusEnhancer :
[DEBUG] --------------------
[INFO]
[DEBUG] --------------------
[ERROR] --------------------
[ERROR] Standard error from the DataNucleus tool + org.datanucleus.enhancer.DataNucleusEnhancer :
[ERROR] --------------------
[ERROR] 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:/home/mgelbana/.m2/repository/org/datanucleus/datanucleus-core/3.2.5/datanucleus-core-3.2.5.jar" is already registered, and you are trying to register an identical plugin located at URL "file:/home/mgelbana/.m2/repository/org/datanucleus/datanucleus-core/4.0.0-m3/datanucleus-core-4.0.0-m3.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:/home/mgelbana/.m2/repository/org/datanucleus/datanucleus-core/3.2.5/datanucleus-core-3.2.5.jar" is already registered, and you are trying to register an identical plugin located at URL "file:/home/mgelbana/.m2/repository/org/datanucleus/datanucleus-core/4.0.0-m3/datanucleus-core-4.0.0-m3.jar."
Well i simply changed all versions to the latest 4.0.0-m2 when I wanted to use it. Can't get simpler.