I finally found a workaround for this. It's not the most elegant solution, but I don't think there's another one.
The workaround was to add the datanucleus-core dependency to the compiler plugin (please note the compile
scope.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<dependencies>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>3.2.8</version>
<scope>compile</scope>
</dependency>
</dependencies>
...
</plugin>
The datanucleus-core dependency is added with the runtime
scope
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>3.2.8</version>
<scope>runtime</scope>
</dependency>
And the datanucleus-core default version from the datanucleus enhancer plugin is overridden with 3.2.8
.
<plugin>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-maven-plugin</artifactId>
<version>3.3.0-release</version>
<dependencies>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>3.2.8</version>
</dependency>
</dependencies>
</plugin>
It works for version 3.2.9 too.