|
Apache Maven is a project management and
build tool that is quite common in organisations. It continues on from where
Maven1 left off though not providing backwards compatibility
with Maven1.
The main thing that you need to bear in mind is that DataNucleus jars are present in
DataNucleus own Maven repository so all you need to do is point your Maven2 project at
this repository. You do this by including the following in your
pom.xml
<project>
...
<repositories>
<repository>
<id>DataNucleus_Repos</id>
<name>DataNucleus Repository</name>
<url>http://www.datanucleus.org/downloads/maven</url>
<layout>legacy</layout>
</repository>
<repository>
<id>DataNucleus_Repos2</id>
<name>DataNucleus Repository</name>
<url>http://www.datanucleus.org/downloads/maven2</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>DataNucleus_2</id>
<url>http://www.datanucleus.org/downloads/maven2/</url>
</pluginRepository>
</pluginRepositories>
</project>
So this make the DataNucleus Maven1 and Maven2 repositories available, and also
makes the DataNucleus Maven2 plugin available.
Now that you have the DataNucleus jars available to you, via the repositories, you
want to perform DataNucleus operations. The primary operations are enhancement
and SchemaTool (for RDBMS). To run the enhancer you do
If you want this to be done automatically after compiling then you should add the following
into your pom.xml
<project>
...
<build>
<plugins>
<plugin>
<groupId>org.datanucleus</groupId>
<artifactId>maven-datanucleus-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<configuration>
<mappingIncludes>**/*.jdo, **/*.class</mappingIncludes>
<log4jConfiguration>${basedir}/log4j.properties</log4jConfiguration>
<verbose>true</verbose>
<enhancerName>ASM</enhancerName>
<props>${basedir}/datanucleus.properties</props>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
</plugin>
</plugin>
</build>
</project>
So whenever compile takes place it then does an enhance using the DataNucleus Maven2
plugin.
SchemaTool is achieved similarly, via
mvn datanucleus:schema-create
|
|