I've been using Avaje.org ebean ORM layer for a while, but I don't understand how to enable the byte-code enhancement functionality described in the "Ebean v2.6.0 User Guide" with Maven.
I found a configuration example on the Avaje.org homepage, but it doesn't work. Neither does the demo Maven boilerplate on GitHub.
Help!
OBSOLETE ANSWER
This answer is for a very old version of EBeans, please disregard it.
Original Content
The example on the Avaje page has some mistakes.
The complete config should be:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>process-ebean-enhancement</id>
<phase>process-classes</phase>
<configuration>
<tasks>
<property name="compile_classpath" refid="maven.compile.classpath" />
<echo
message="Ebean enhancing test classes debug level -----------------------------------" />
<echo message="Classpath: ${compile_classpath}" />
<taskdef name="ebeanEnhance" classname="com.avaje.ebean.enhance.ant.AntEnhanceTask"
classpath="${compile_classpath}" />
<ebeanEnhance classSource="${project.build.outputDirectory}"
packages="com.mycompany.**" transformArgs="debug=1" />
</tasks>
<encoding>UTF-8</encoding>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
This will enhance all of the @Entity classes in the "src/main/java/com/mycompany" and below.
You can improve execution time by being more restrictive on the packages to examine.
Also, you may need to duplicate this config if you do need to enhance test classes. In that case, use the 'proces-test-classes' phase for a second block.
JBCP's answer is for old ebean version (org.avaje.ebeanorm
). For newer version (io.ebean
) you need to change to ebean-maven-plugin
.
<plugin>
<groupId>io.ebean</groupId>
<artifactId>ebean-maven-plugin</artifactId>
<version>${ebean.version}</version>
<executions>
<execution>
<id>main</id>
<phase>process-classes</phase>
<goals>
<goal>enhance</goal>
</goals>
<configuration>
<packages>com.package1.**,com.package2.**</packages>
<transformArgs>debug=1</transformArgs>
<classSource>${project.build.outputDirectory}</classSource>
<classDestination>${project.build.outputDirectory}</classDestination>
</configuration>
</execution>
</executions>
</plugin>
Note: ebean plugin version should be the same as ebean version.
Reference: Maven Repo, Github
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With