Building an EAR project
Maven provides support to generate Java EE Enterprise Archive (EAR) files. These can be deployed in application servers such as JBoss, WebLogic, and WebSphere.
How to do it...
- Run the following command from the command prompt:
mvn archetype:generate -DgroupId=com.packt.cookbook -DartifactId=simple-ear -DarchetypeArtifactId=wildfly-javaee7-webapp-ear-archetype -DarchetypeGroupId=org.wildfly.archetype -DinteractiveMode=false
- Observe the result:
- Build the generated project:
mvn clean package
- Observe the generated output:
- Open the
target
folder:
How it works...
We used the Maven Archetype plugin to bootstrap a simple EAR project. It generated a multi-module project, which has an EJB module, web module, and a EAR module along with the aggregate pom file. When you examine the pom
file of the EAR module, you will notice that the packaging
type is set to ear
.
Once built, Maven builds all the modules. In the EAR module, it uses the packaging information to invoke the ear
goal of the...