For to enhance the classes and to make normal Java classes "persistable", I have used DataNucleus Enhancer. The issue I am having is: No files to run datanucleus tool (error log shown below) and because of that datanucleus is not enhancing the classes. How the datanucleus run the files for enhancement?
Pom.xml
Dependencies of datanucleus
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-api-jdo</artifactId>
<version>4.0.5</version>
<!--<scope>compile</scope> -->
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>4.0.6</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-rdbms</artifactId>
<version>4.0.9</version>
<scope>runtime</scope>
</dependency>
Datanucleus Plugin for enhance
<plugin>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-maven-plugin</artifactId>
<version>5.2.1</version>
<configuration>
<api>JDO</api>
<persistenceUnitName>MyUnit_Example</persistenceUnitName> <!-- todo: change persistance name-->
<log4jConfiguration>${pom.basedir}/data/log4j.properties</log4jConfiguration>
<generateConstructor>true</generateConstructor>
<verbose>true</verbose>
<alwaysDetachable>true</alwaysDetachable>
<metadataIncludes>${pom.basedir}/dir_name_1/dir_name_2/model**/*.class</metadataIncludes>
</configuration>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
</plugin>
Warning list
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for org.mortbay.jetty:servlet-api:jar:2.5-6.0.0beta12 is missing, no dependency information available
[INFO]
[INFO] --- datanucleus-maven-plugin:5.2.1:enhance (default-cli) @ forsteinrichtung ---
[WARNING] No files to run DataNucleus tool 'org.datanucleus.enhancer.DataNucleusEnhancer'
My setup for enhance the classes, I hope it could help you to find a solution. You need to add a persistence.xml, update the Datanucleus dependency artifact versions and add a dependency of javax.jdo for datanuclues which provides an interface to java model abstraction for persistence.
pom.xml
Depandancy for Datanucleus
Datanucleus Plugin for enhance
persistence.xml
The location for
persistence.xmlis "resources > META-INF > persistence.xml". Ifpersistence.xmldoes not exist then one need to create newpersistence.xml.