Search code examples
javamaven-2ejbmaven-plugin

Building both war and ear files for same project using maven



In my project i have both web related stuff(jsps, controllers, ..) and EJB beans.
Now i need to build war file with web related stuff and deploy that into tomcat and
need to build ear file for EJB's and deploy that into jboss using maven.

Can anyone suggest me a solution to modify the pom.xml accordingly.

Thank you,
Pavan


Solution

  • The best way is to split your project into multiple sub-projects: one builds the EJBs, one builds the WAR, and a third packages them together. This is described in Maven: The Complete Reference, and with an example in Better Builds with Maven.