Minimal Maven kickstart project
A minimal project using a maven configuration
can be found on git hub.
It is recommended that you get the
project from there as a kickstart.
... the interesting bits of the pom are:
The ebean dependency
<dependency>
<groupId>org.avaje<groupId>
<artifactId>ebean<artifactId>
<version>2.7.1<version>
<dependency>
useSystemClassloader
For ebean to find the classes during maven testing
we need to make sure we use the useSystemClassloader = false.
<plugin>
<groupId>org.apache.maven.plugins<groupId>
<artifactId>maven-surefire-plugin<artifactId>
<configuration>
<useSystemClassLoader>false</useSystemClassLoader>
<configuration>
<plugin>
Enhance the entity beans
You have enhance the entity beans as part of the build.
To do so use the antrun plugin.
<plugin>
<groupId>org.apache.maven.plugins<groupId>
<artifactId>maven-antrun-plugin<artifactId>
<executions>
<execution>
<id>compile<id>
<phase>process-ebean-enhancement<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.testOutputDirectory}"
packages="org.avaje.demo.test.model.**" transformArgs="debug=1" />
<tasks>
<encoding>UTF-8<encoding>
<configuration>
<goals>
<goal>run<goal>
<goals>
<execution>
<executions>
<plugin>
Unit tests not finding entities
If you find that maven is not finding your entity classes when
running unit tests it is likely as issue with the classpath.
Check the logs to see if you see something like:
Running org.avaje.demo.test.TestSimpleConnection
2/03/2010 9:03:45 PM com.avaje.ebean.Ebean clinit
INFO: Ebean Version[2.4.0-20100227] Java Version[1.6.0_10-beta]
2/03/2010 9:03:45 PM com.avaje.ebean.server.util.ClassPathSearch findClasses
WARNING: No Entities found in ClassPath using ClassPathReader
[com.avaje.ebean.server.util.DefaultClassPathReader@1729854]
Classpath Searched[[file:/C:/Users/rob/AppData/Local/Temp/surefirebooter25880.jar]]
2/03/2010 9:03:45 PM com.avaje.ebean.server.core.BootupClassPathSearch search
INFO: Classpath search hits in jars[] pkgs[] searchTime[5]
Maven by default runs with it's own classpath magic and we need to turn that off.
<plugin>
<groupId>org.apache.maven.plugins<groupId>
<artifactId>maven-surefire-plugin<artifactId>
<configuration>
<useSystemClassLoader>false<useSystemClassLoader>
<configuration>
<plugin>