1) maven-ejb-plugin
Ejb3 does not require the ejb-jar.xml anymore (finally!!) and the behaviour is actually different if it is supplied one anyways.
Thus we simply do not provide one in our project.
Assuming everything else is correct and you are creating an ejb artifact you get an error about a missing ejb-jar.xml!
So you simply provide an empty one?
Nope, ejb3 uses the one you provide if there is one, and we don't want that.
Filtering for the ejb-jar.xml in maven?
No again, maven still complains about the missing file...
So let's use the <ejbVersion> tags in our maven pom together with the maven-ejb-plugin to create ejb3-compliant jar files.
[snip]
<plugin>
<artifactId>maven-ejb-plugin</artifactId>
<version>2.0-alpha3</version>
<configuration>
<ejbVersion>3.0</ejbVersion>
</configuration>
</plugin>
[snip]
No matter which version you actually use, you still get an error about a missing ejb-jar.xml.
Before you ask:
Yes, the plugin in the global repository is buggy.
Yes, to get support for ejb3 you have to compile and install it yourself.
The following should get this done:
This checks out the source (assuming you have subversion istalled) from the development trunk. I use this since I am behind a firewall and cannot use the normal checkout
$ svn checkout https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-ejb-plugin maven-ejb-plugin
CD into the subfolder and install the artifact:
cd maven-ejb-plugin
mvn install
With the following, maven should now accept the <ejbVersion> tags:
[snip]
<plugin>
<artifactId>maven-ejb-plugin</artifactId>
<version>2.1-SNAPSHOT</version>
<configuration>
<ejbVersion>3.0</ejbVersion>
</configuration>
</plugin>
[snip]
2) Dependencies when using ejb's
Remember that when you have a multi-module project and one of the modules is an ejb, you cannot reference the module directly in another pom:
[snip]
<dependency>
<groupId>root.project</groupId>
<artifactId>businessClasses</artifactId>
</dependency>
<dependency>
<groupId>root.project</groupId>
<artifactId>ejb</artifactId>
</dependency>
[snip]
What you get is an error complaining about a missing >version< tag in the corresponding pom.
Since you are creating an ejb you have to make sure you include it as an ejb, too:
[snip]
<dependency>
<groupId>root.project</groupId>
<artifactId>businessClasses</artifactId>
</dependency>
<dependency>
<groupId>root.project</groupId>
<artifactId>ejb</artifactId>
<version>1.0</version>
<type>ejb</type>
</dependency>
[snip]
We'll see what else I can dig up... :)
No comments:
Post a Comment