I'm trying to build my application for GoogleAppEngine using maven. I've added the following to my pom which should "enhance" my classes after building, as suggested on the DataNucleus documentation
<plugin>
<groupId>org.datanucleus</groupId>
<artifactId>maven-datanucleus-plugin</artifactId>
<version>1.1.4</version>
<configuration>
<log4jConfiguration>${basedir}/log4j.properties</log4jConfiguration>
<verbose>true</verbose>
</configuration>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
</plugin>
According to the documentation on GoogleAppEngine, you have the choice to use JDO or JPA, I've chosen to use JPA since I have used it in the past. When I try to build my project (before I upload to GAE) using mvn clean package
I get the following output
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.
Missing:
----------
1) javax.jdo:jdo2-api:jar:2.3-ec
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=javax.jdo -DartifactId=jdo2-api -Dversion=2.3-ec -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=javax.jdo -DartifactId=jdo2-api -Dversion=2.3-ec -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
Path to dependency:
1) org.datanucleus:maven-datanucleus-plugin:maven-plugin:1.1.4
2) javax.jdo:jdo2-api:jar:2.3-ec
----------
1 required artifact is missing.
for artifact:
org.datanucleus:maven-datanucleus-plugin:maven-plugin:1.1.4
from the specified remote repositories:
__jpp_repo__ (file:///usr/share/maven2/repository),
DN_M2_Repo (http://www.datanucleus.org/downloads/maven2/),
central (http://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3 seconds
[INFO] Finished at: Sat Apr 03 16:02:39 BST 2010
[INFO] Final Memory: 31M/258M
[INFO] ------------------------------------------------------------------------
Any ideas why I should get such an error? I've searched through my entire source code and I'm not referencing JDO anywhere, so unless the app engine libraries require it, I'm not sure why I get this message.
The DataNucleus Maven plugin requires the JDO2 API JAR (even for JPA) as documented here and as reported in the trace:
Path to dependency:
1) org.datanucleus:maven-datanucleus-plugin:maven-plugin:1.1.4
2) javax.jdo:jdo2-api:jar:2.3-ec
The odd part is that jdo2-api-2.3-ec.jar
is in the DataNucleus Maven repository (that is declared in the POM of the plugin) and Maven has checked this repository as we can see in the trace.
Update: Ok, this is definitely weird and I don't know why the build is failing exactly (maybe a problem with dependencies ranges). As a workaround, declare the JDO2 API JAR as dependency in the plugin:
<project>
...
<build>
<plugins>
<plugin>
<groupId>org.datanucleus</groupId>
<artifactId>maven-datanucleus-plugin</artifactId>
<version>1.1.4</version>
<configuration>
<log4jConfiguration>${basedir}/log4j.properties</log4jConfiguration>
<verbose>true</verbose>
</configuration>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>javax.jdo</groupId>
<artifactId>jdo2-api</artifactId>
<version>2.3-ec</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</plugin>
...
</plugins>
...
</build>
</project>
With this dependency declared, the JAR gets downloaded.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With