When running mvn compile of downloaded sample project datanucleus-samples-jpa-tutorial-3.1-src.zip, get the following exception...
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for org.datanucleus.samples:datanucleus-samples-jpa-tutorial:jar:3.1
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-clean-plugin is missing. @ line 177, column 21
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 196, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building DataNucleus Tutorial for JPA 3.1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ datanucleus-samples-jpa-tutorial ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 2 resources
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ datanucleus-samples-jpa-tutorial ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-datanucleus-plugin:3.1.0-m3:enhance (default) @ datanucleus-samples-jpa-tutorial ---
[INFO] DataNucleus Enhancer (version 3.1.0.release) : Enhancement of classes
[ERROR] --------------------
[ERROR] Standard error from the DataNucleus tool + org.datanucleus.enhancer.DataNucleusEnhancer :
[ERROR] --------------------
[ERROR] Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.datanucleus.JDOClassLoaderResolver.classOrNull(JDOClassLoaderResolver.java:548)
at org.datanucleus.JDOClassLoaderResolver.classForName(JDOClassLoaderResolver.java:200)
at org.datanucleus.JDOClassLoaderResolver.classForName(JDOClassLoaderResolver.java:410)
at org.datanucleus.metadata.MetaDataManager.loadPersistenceUnit(MetaDataManager.java:954)
at org.datanucleus.enhancer.DataNucleusEnhancer.getFileMetadataForInput(DataNucleusEnhancer.java:793)
at org.datanucleus.enhancer.DataNucleusEnhancer.enhance(DataNucleusEnhancer.java:525)
at org.datanucleus.enhancer.DataNucleusEnhancer.main(DataNucleusEnhancer.java:1258)
[ERROR] --------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.706s
[INFO] Finished at: Thu Sep 27 18:00:35 BST 2012
[INFO] Final Memory: 7M/247M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.datanucleus:maven-datanucleus-plugin:3.1.0-m3:enhance (default) on project datanucleus-samples-jpa-tutorial: The DataNucleus tool org.datanucleus.enhancer.DataNucleusEnhancer exited with a non-null exit code. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Maven3 gives warnings but then they are ignorable (and down to the Maven teams inability to consider backwards compatibility - the sample is designed for Maven2).
"java.lang.UnsupportedClassVersionError: Bad version number in .class file"
is obviously related to your JRE in use (undefined). I've used 1.6 and 1.7 with no problems.