Building J2EE Projects with Maven
Subject:   ejb-jar.xml inclusion?
Date:   2005-10-14 15:02:59
From:   vmassol
Response to: ejb-jar.xml inclusion?

Hi smcnamara,

Yes, this is a bug in the code for the article. I've fixed it in the SVN repository (

Basically the business/project.xml file was missing a <resource> tag to copy the xdoclet-generated resources to the EJB JAR (the ejb-jar.xml is generated):


There was also the same error in the presentation/ subproject. Specifically the web.xml and taglibs generated by xdoclet were not included in the war. However, the problem is that the WAR plugin doesn't honor the <resource> tag... So the solution was to modify presentation/maven.xml as follows:

<preGoal name="java:compile">
<attainGoal name="xdoclet:webdoclet"/>

<!-- Hack because the WAR plugin does not honor
the <resources> tag (Note that the EJB
plugins does honor it!) -->
<ant:copy todir="${maven.war.webapp.dir}"


Last, there were also issues in the EAR generation:

* The applications/petstore/ was missing a property telling the EAR plugin to generate the application.xml deployment descriptor:

maven.ear.appxml.generate = true

* The applications/petstore/project.xml file was not marking the xpetstore-business dependency to be included in the EAR:


Same for the xpetstore-presentation dependency:


Sorry for all those bugs in the source code. I don't think the article has any problem but I had not finished the parts of the samples that were not explicitely covered by the article. They should all build now. However you should bear in mind that they'll probably not run as they haven't been tested at runtime. The idea was to write a second article for showing how to perform functional testing but I've not written it yet... :-)