boutta
boutta

Reputation: 24639

When should I use ejb as packaging type for a JAR (or when is a JAR an EJB module)?

I have a maven project which is packaged using the ejb-plugin. This is so because the project holds one interface which is annotated @Remote.The project does not hold the implementation.

Should I use the ejb-plugin here or is this a simple jar (used as a library)?

What makes a maven project an EJB-Module?

Upvotes: 2

Views: 3166

Answers (1)

Stevo Slavić
Stevo Slavić

Reputation: 2348

Use a simple jar packaging for module with interfaces.

In module with implementation use ejb packaging and define a simple jar dependency to module with interfaces. For modules with ejb packaging maven will run ejb:ejb mojo of maven-ejb-plugin - do configure it (e.g. set ejbVersion to 3.0). For ejb module Maven will produce a jar archive. What used to make ejb jar specific is ejb-jar.xml, but starting from EJB 3.0 that's optional, annotations are used for metadata. Valid deployable ejb jar is one that has at least one EJB bean (session, entity, or message-driven).

In third module with ear packaging you can configure maven-ear-plugin with a reference to ejb module; ear module will produce ear archive with ejb module included, and with all ejb module dependencies as well, including interfaces jar module.

Upvotes: 0

Related Questions