If i'm working with ejb 3.1, what's the différence between
<packaging>jar</packaging>
and
<packaging>ejb</packaging>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<version>2.3</version>
<configuration>
<ejbVersion>3.1</ejbVersion>
</configuration>
</plugin>
As mentioned at http://maven.apache.org/plugins/maven-ejb-plugin/usage.html ,
"The plugin doesn't do any EJB specific processing during the generation of the jar except for validating the existence of an EJB deployment descriptor if the EJB version is 2.0+ "
Since you have ejb 3.1 the ejb-jar.xml file is optional hence unless you want to generate client stubs and utility classes as mentioned in Martin' comments , it won't make much a difference if you use jar packaging .
Using packaging type ejb
includes the execution of the maven-ejb-plugin. This is not the case for packaging type jar
(unless you explicitly configure it). The plugin configuration as stated in the original question is only required if you need to define a configuration that differs from defaults.
To my knowledge the main purpose of the maven-ejb-plugin is (was) for creating an EJB client module (only including interfaces). But IMHO this is no longer the recommended way. Usually you provide the APIs via a separate module and do not let the ejb-plugin create it automatically.
I would also suggest comparing effective pom outputs from maven help plugin for both jar
and ejb
project types:
mvn help:effective-pom
It will allow to compare what maven generates for ejb
projects and for jar
projects.
The difference between ejb
and jar
also makes sence when packaging into ear plugin. As a rule, ejbModule
configuration property is used for ejb-jars, containing beans, while jarModule
configuration property of the ear plugin is used for libraries (jar archives).