As Google App. Engine uses a datanucleus plugin for database access, I’ve now switched to it (and leaved Hibernate).

Datanucleus uses bytecode instrumentation for persistance mapping, but not in real time like Hibernate does. Your classes must be enhanced just after compilation.

With maven, it’s not a problem for me, as described here:
http://www.datanucleus.org

Netbeans + Linux + Maven + datanucleus-plugin = hell

Using datanucleus-maven-plugin 1.1.4 (don’t use version 1.1.3 it will force download of Datanucleus 2.0), I get an error when running the compilation under Netbeans.

1.
2.
Embedded error: Error while executing process.
java.io.IOException: error=2, No such file or directory.

I then enable the log for the plugin to see what’s happening, but get no logs. No logs at all…

Of course, nothing in the doc about this problem, so I finally searched the plugin source code:

I see that the plugin is calling « java » directly to process the enhancements. And it seems that when Netbeans calls Maven for compilation, it doesn’t provide the linux path, so the plugin couldn’t start java.

I noticed then a hidden or not-so-documented option, fork, that if set to false, will call directly the bytecode enhancer with no calls to « java ».
Here is the maven configuration to use:

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
<plugin>
  <groupId>org.datanucleus</groupId>
  <artifactId>maven-datanucleus-plugin</artifactId>
  <version>1.1.4</version>
  <configuration>
    <fork>false</fork>
    <mappingIncludes>**/*.class</mappingIncludes>
    <api>JPA</api>
    <log4jConfiguration>
      ${basedir}/src/test/resources/log4j.properties
    </log4jConfiguration>
    <verbose>true</verbose>
    <enhancerName>ASM</enhancerName>
    <props>
       ${project.build.testOutputDirectory}/datanucleus.properties
    </props>
  </configuration>
  <dependencies>
    <dependency>
      <groupId>org.apache.derby</groupId>
      <artifactId>derbyclient</artifactId>
      <version>10.5.3.0_1</version>
    </dependency>
    <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
      <version>1.2.12</version>
    </dependency>
  </dependencies>
</plugin>

So I tried, and this worked like a charm.
PS: The other plugin, schema-create doesn’t have this option, so I have to run it from command line.