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

  1. 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
    
  2. Observe the result:
    How to do it...
  3. Build the generated project:
    mvn clean package
    
  4. Observe the generated output:
    How to do it...
  5. Open the target folder:
    How to do it...

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 Maven EAR plugin to create a EAR of the project contents.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.197.213