Hello,
(question at the end, after the project configuration)
I created a MAVEN Google App Engine project with several sub-modules:
- WAR: this packages the App for uploading to GAE / running locally in dev server
- main JARs: just a couple of jars with business logic
- persistence layer JAR: this is the JAR that includes our JPA2 (Datanucleus) infrastructure layer
Using the MAVEN project all works fine, I mean, running "mvn package" in project (3) does what it is expected (compile, enhance, etc etc), and running "mvn package" in project (1) works well too (packages all dependencies from (2) and (3), etc.. Thus, running GAE dev server locally from the package generated from project (1) POM works without a problem (I can persist entities, load them, etc).
Now, I want to avoid the overhead of running "mvn install" in project (1) everytime I make a change in my code. So, I created a "run configuration" for GAE:
And this is the artifact definition:
I added all dependencies output to the WAR-exploded, so that I get all I need in the target folder (similar to a "mvn package" in the WAR project + explode).
Now, the sub-module "core-infra-jpa" has to be enhanced, so the configuration for that module is:
So, i I'm not wrong, the run configuration will:
- Make all project sub-modules
- In the case of core-infra-jpa, enhance after make
- Generate WAR-exploded: copy al target folders to WAR-target-folder (this includes classes enhanced from (2))
- Run GAE dev server
My problem, the enhance step fails:
Google AppEngine Enhancer: Encountered a problem: Unexpected exception
Google AppEngine Enhancer: mar 12, 2014 10:15:22 AM org.datanucleus.api.ApiAdapterFactory getApiAdapter
Google AppEngine Enhancer: Grave: Error : Un error ocurrio cuando creando un adaptador "org.datanucleus.api.jpa.JPAAdapter" (quizas no tengas el jar apropiado datanucleus-api-XXX en el CLASSPATH, o el api jar para la especificacion que utilisas?) : Absent Code attribute in method that is not native or abstract in class file javax/persistence/PersistenceException
Google AppEngine Enhancer: java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/persistence/PersistenceException
Google AppEngine Enhancer: at java.lang.ClassLoader.defineClass1(Native Method)
The problem is that the enhancer process needs some JARs in the classpath, this is how I got it working in MAVEN (you can see how I added dependencies to be used when running the enhacenment step):
...
<plugin>
<groupId>org.datanucleus</groupId>
<artifactId>maven-datanucleus-plugin</artifactId>
<version>3.1.3</version>
<configuration>
<persistenceUnitName>default</persistenceUnitName>
<api>JPA</api>
<fork>false</fork>
<verbose>true</verbose>
</configuration>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.google.appengine.orm</groupId>
<artifactId>datanucleus-appengine</artifactId>
<version>2.1.2</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-api-jpa</artifactId>
<version>3.1.3</version>
</dependency>
<dependency>
<groupId>javax.jdo</groupId>
<artifactId>jdo-api</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>3.1.3</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-enhancer</artifactId>
<version>3.1.1</version>
</dependency>
</dependencies>
</plugin>
...
So, finally, my question: how can I add those dependencies to JAVA CLASSPATH for the IntelliJ/GAE enhancer process?