Problem
The openJPA's enhancer plugin throws an error message:
... an api incompatibility was encountered while executing org.codehaus.mojo:openjpa-maven-plugin ..
For instance:
Description Resource Path Location Type
Execution enhancer of goal org.codehaus.mojo:openjpa-maven-plugin:1.2:enhance failed: An API incompatibility was encountered while executing
org.codehaus.mojo:openjpa-maven-plugin:1.2:enhance: java.lang.VerifyError: Expecting a stackmap frame at branch target 36 in method
br.com.adr.simplest.entities.Category.<clinit()V at offset 27
...
The enhancer execution from "openjpa-maven-plugin" of "org.codehaus.mojo" is declared in pom.xml file at:
<groupIdorg.codehaus.mojo</groupId
<artifactIdopenjpa-maven-plugin</artifactId
...
<executions
<execution
<idenhancer</id
On eclipse, you can see on "Markers" panel:
Solution
It's due libraries's incompatibilities.
In this case, the openjpa version is not compatible with the java's version used by the compiler, defined at "maven-compiler-plugin".
Follow by the example below, in order to fix the problem.
Before
...
<dependency
<groupIdorg.apache.openjpa</groupId
<artifactIdopenjpa-all</artifactId
<version2.1.1</version
</dependency
...
<plugin
<groupIdorg.apache.maven.plugins</groupId
<artifactIdmaven-compiler-plugin</artifactId
<version2.3.2</version
<configuration
<source1.6</source
<target1.6</target
</configuration
</plugin
...
<plugin
<groupIdorg.codehaus.mojo</groupId
<artifactIdopenjpa-maven-plugin</artifactId
<version1.2</version
<configuration
<includesbr/com/adr/*/entities/*/*.class</includes
<includesbr/com/adr/*/entities/*.class</includes
<addDefaultConstructortrue</addDefaultConstructor
<enforcePropertyRestrictionstrue</enforcePropertyRestrictions
</configuration
<executions
<execution
<idenhancer</id
<phaseprocess-classes</phase
<goals
<goaltest-enhance</goal
<goalenhance</goal
</goals
</execution
</executions
<dependencies
<dependency
<groupIdorg.apache.openjpa</groupId
<artifactIdopenjpa</artifactId
<!-- set the version to be the same as the level in your runtime --
<version2.1.1</version
</dependency
</dependencies
</plugin
...
-----------------------------------------------------------------------
After:
...
<dependency
<groupIdorg.apache.openjpa</groupId
<artifactIdopenjpa-all</artifactId
<version2.2.2</version
</dependency
...
<plugin
<groupIdorg.apache.maven.plugins</groupId
<artifactIdmaven-compiler-plugin</artifactId
<version3.1</version
<configuration
<source1.7</source
<target1.7</target
</configuration
</plugin
...
<plugin
<groupIdorg.codehaus.mojo</groupId
<artifactIdopenjpa-maven-plugin</artifactId
<version1.2</version
<configuration
<includesbr/com/adr/*/entities/*/*.class</includes
<includesbr/com/adr/*/entities/*.class</includes
<addDefaultConstructortrue</addDefaultConstructor
<enforcePropertyRestrictionstrue</enforcePropertyRestrictions
</configuration
<executions
<execution
<idenhancer</id
<phaseprocess-classes</phase
<goals
<goaltest-enhance</goal
<goalenhance</goal
</goals
</execution
</executions
<dependencies
<dependency
<groupIdorg.apache.openjpa</groupId
<artifactIdopenjpa</artifactId
<!-- set the version to be the same as the level in your runtime --
<version2.2.2</version
</dependency
</dependencies
</plugin
..
-----------------------------------------------------
NOTE:
Use properties to reference the versions.
They make things easier.
For instance:
<properties
<openjpa.version2.2.2</openjpa.version
</properties
...
<dependency
<groupIdorg.apache.openjpa</groupId
<artifactIdopenjpa-all</artifactId
<version${openjpa.version}</version
</dependency
...
<!--
The enhancer pluging:
-->
...
<executions
<execution
<idenhancer</id
<phaseprocess-classes</phase
<goals
<goaltest-enhance</goal
<goalenhance</goal
</goals
</execution
</executions
<dependencies
<dependency
<groupIdorg.apache.openjpa</groupId
<artifactIdopenjpa</artifactId
<!-- set the version to be the same as the level in your runtime --
<version${openjpa.version}</version
</dependency
</dependencies
Use properties to reference the versions.
They make things easier.
For instance:
<properties
<openjpa.version2.2.2</openjpa.version
</properties
...
<dependency
<groupIdorg.apache.openjpa</groupId
<artifactIdopenjpa-all</artifactId
<version${openjpa.version}</version
</dependency
<!--
The enhancer pluging:
-->
...
<execution
<idenhancer</id
<phaseprocess-classes</phase
<goals
<goaltest-enhance</goal
<goalenhance</goal
</goals
</execution
</executions
<dependencies
<dependency
<groupIdorg.apache.openjpa</groupId
<artifactIdopenjpa</artifactId
<!-- set the version to be the same as the level in your runtime --
<version${openjpa.version}</version
</dependency
</dependencies
No comments:
Post a Comment