Here's some pom.xml snippets that do not rely on an external maven plugin for
build-time weaving/canonical model metadata generation using a maven profile
execution (executed by "mvn -P jpa-gen compile"). It also contains an optional
Eclipse m2e lifecycle-mapping that will tie in the model generation to the
Eclipse IDE when changes are made.
...
<!-- JPA canonical model metadata generation, use: "mvn -P
jpa-gen compile" -->
<!-- generated sources dir:
${project.build.directory}/generated-sources/annotations -->
<!-- NOTE: multiple PUs requires either a
"eclipselink.persistenceunit"
compiler argument or a
"eclipselink.canonicalmodel.subpackage" property described
in https://bugs.eclipse.org/bugs/show_bug.cgi?id=308713
or it will try to
process canonicals 2x -->
<!-- IMPORTANT: May show compilation error, but canonical
classes will be generated -->
<profile>
<id>jpa-gen</id>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${plugin.compiler.version}</version>
<configuration>
<proc
combine.self="override">only</proc>
<compilerArguments
combine.children="append">
<Aeclipselink.persistenceunits>${db.jpa.pu.name}</Aeclipselink.persistenceunits>
<Aeclipselink.persistencexml>${db.jpa.xml.file}</Aeclipselink.persistencexml>
</compilerArguments>
<includes
combine.self="override">
<include>**/entity/jpa/*.java</include>
</includes>
<generatedSourcesDirectory>${project.build.sourceDirectory}</generatedSourcesDirectory>
<annotationProcessors
combine.self="override">
<annotationProcessor>org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor</annotationProcessor>
</annotationProcessors>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa.modelgen</artifactId>
<version>${eclipselink.jpa.version}</version>
</dependency>
</dependencies>
</profile>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>${plugin.exec.version}</version>
<executions>
<!-- JPA build time enhancements -->
<execution>
<id>eclipselink-static-weaver</id>
<phase>process-test-classes</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<includeProjectDependencies>true</includeProjectDependencies>
<includePluginDependencies>true</includePluginDependencies>
<mainClass>org.eclipse.persistence.tools.weaving.jpa.StaticWeave</mainClass>
<classpathScope>test</classpathScope>
<classpath>
<!--
<dependency>${project.groupId}:${project.artifactId}</dependency> -->
<!--
<dependency>javax.servlet:javax.servlet-api</dependency> -->
<!--
<dependency>org.eclipse.persistence:org.eclipse.persistence.weaving</dependency>
-->
<!--
<dependency>org.eclipse.persistence:org.eclipse.persistence.jpa</dependency> -->
<!--
<dependency>org.eclipse.persistence:javax.persistence</dependency> -->
</classpath>
<arguments>
<argument>-loglevel</argument>
<argument>WARNING</argument>
<argument>-persistenceinfo</argument>
<argument>${project.build.testOutputDirectory}</argument>
<argument>${project.build.outputDirectory}</argument>
<argument>${project.build.outputDirectory}</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
...
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to
store Eclipse m2e settings
only. It has no influence on the Maven
build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<!-- m2e needs
to execute JPA enhancement -->
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<versionRange>[${plugin.exec.version},)</versionRange>
<goals>
<goal>java</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
...
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa</artifactId>
<version>${eclipselink.jpa.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>${persistence.version}</version>
</dependency>
...
-----Original Message-----
From: Karl Kildén [mailto:[email protected]]
Sent: Wednesday, August 20, 2014 2:00 AM
To: [email protected]
Subject: Re: Switching to Eclipselink in TomEE plus?
Another Q
What do you eclipselink guys use for weaving?
On 19 August 2014 20:36, Karl Kildén <[email protected]> wrote:
> Thanks Romain & others!
>
>
> On 18 August 2014 21:18, Howard W. Smith, Jr. <[email protected]>
> wrote:
>
>> okay, i just confirmed that with my app and tomee+ 1.7.0. i added the
>> following to my java [startup] options
>>
>> -Dopenejb.eclipselink.jmx=false
>>
>> and i see the following in the log file:
>>
>> 2014-08-18 15:14:00 Commons Daemon procrun stdout initialized [EL
>> Info]: 2014-08-18 15:14:34.656--ServerSession(95555569)--EclipseLink,
>> version: Eclipse Persistence Services - 2.3.2.v20111125-r10461 [EL
>> Info]: 2014-08-18
>>
>> 15:14:35.246--ServerSession(95555569)--file:/C:/apache-tomee-plus-1.7
>> .0/webapps/mcmsweb/WEB-INF/classes/_mcmsPU
>> login successful
>>
>> That fixed the EclipseLink NullPointerException.
>>
>>
>>
>> On Mon, Aug 18, 2014 at 3:01 PM, Romain Manni-Bucau <
>> [email protected]>
>> wrote:
>>
>> > it is in 1.7
>> >
>> >
>> > Romain Manni-Bucau
>> > Twitter: @rmannibucau
>> > Blog: http://rmannibucau.wordpress.com/
>> > LinkedIn: http://fr.linkedin.com/in/rmannibucau
>> > Github: https://github.com/rmannibucau
>> >
>> >
>> > 2014-08-18 21:00 GMT+02:00 Howard W. Smith, Jr.
>> ><[email protected]
>> >:
>> > > Is this (openejb.eclipselink.jmx=false) added as part of the fix,
>> > > or is openejb.eclipselink.jmx=false available in tomee 7.0 final
>> > > release, already?
>> > >
>> > >
>> > > On Mon, Aug 18, 2014 at 2:36 PM, Romain Manni-Bucau <
>> > [email protected]>
>> > > wrote:
>> > >
>> > >> you can also disable it setting openejb.eclipselink.jmx=false
>> >
>>
>
>