Maven 2 & Packaging ejb vs jar

梦想与她 提交于 2019-12-06 03:57:06

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!