Maven 2 & Packaging ejb vs jar
Asked Answered
F

3

8

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>
Ferricyanide answered 18/9, 2013 at 7:47 Comment(0)
E
4

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 .

Equivalency answered 18/9, 2013 at 8:15 Comment(0)
H
7

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.

Herminahermine answered 18/9, 2013 at 8:5 Comment(2)
Ok, thanks. So the ejb packaging is not really usefull anymore.Ferricyanide
The resulting JAR will probably be pretty much the same but it's still correct to use the packaging type 'ejb'. And as jay stated, it verifies the existence of the EJB deployment descriptor.Encyclopedia
E
4

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 .

Equivalency answered 18/9, 2013 at 8:15 Comment(0)
W
3

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).

Wayne answered 1/7, 2015 at 7:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.