Apache Maven 1.x has reached its end of life, and is no longer supported. For more information, see the announcement. Users are encouraged to migrate to the current version of Apache Maven.

Overview

This document describes the supplied goals that are available when using the J2EE Plug-in with Maven.

Please refer to the Integration document for more information on how to integrate these goals into your project.

The build file utilizes various properties for default and user-configurable settings. All J2EE Plug-in properties are described in the Properties document. The rest of this document assumes your project follows the standard Directory Layout; however, it is possible to override many of these defaults.

J2EE Goals

GoalDescription
j2ee:validate-war Validate a WAR file.
j2ee:ejb Creates an EJBjar file.
j2ee:ear Creates an EAR file.

j2ee:validate-war

The j2ee:validate-war target validates the newly produced war file.

The validator checks the folowing:

  1. The war file exists
  2. It is readable
  3. The war file has a web.xml (it's only a warning if it doesn't exist)
  4. Servlets defined by a <servlet> tag are loadable from the war file and not the classpath
  5. JSPs defined by a <servlet> tag exist in the war
  6. Taglibs defined by a <taglib> have a <taglib-location> that exists in the war
  7. Error pages specified by a <location> nested within an <error-page> element must exist in the war file
  8. Login and error pages specified in the <form-login-config > element must exist in the war file

j2ee:ejb

The j2ee:ejb target generates the ejb jar file for the project. Optionally it can also create jars containing the local and remote interfaces. The files are produced in the ${maven.build.dir}/ejb directory and have a name based on the ${maven.j2ee.ejb.name} property.

The files generated are:

  • ${maven.j2ee.ejb.name}.jar
  • ${maven.j2ee.ejb.name}-remote.jar (optional)
  • ${maven.j2ee.ejb.name}-local.jar (optional)

Maven also includes the license file, LICENSE.txt, if it exists, in the META-INF directory.

The contents of the ejb file include:

ItemDescription
ejb-jar.xml A J2EE enterprise bean deployment descriptor, which is placed in the root of the resulting ear file. The ${maven.j2ee.ejb.conf.dir} and associated includes and excludes properties defines the location of this file.
Classes The files in the ${maven.build.dest} directory to be included is specified using the ${maven.j2ee.ejb.includes} and ${maven.j2ee.ejb.excludes} properties.
Meta-Inf Files to be included the META-INF directory of the ejb jar file may be specified using the ${maven.j2ee.ejb.conf.dir}, ${maven.j2ee.ejb.conf.includes} and ${maven.j2ee.ejb.conf.excludes} properties.

j2ee:ear

The j2ee:ear target generates an ear file for the project. The ear file is produced in the ${maven.build.dir} directory and has a name defined by the ${maven.j2ee.ear.name} property.

Maven also includes the license file, LICENSE.txt, if it exists, under the directory META-INF.

The contents of the ear file include:

ItemDescription
application.xml A J2EE enterprise application deployment descriptor, which is placed in the META-INF of the resulting ear file. The ${maven.j2ee.ear.appxml} property defines the location of this file. It defaults to src/application.xml
Other Content Any dependencies specified in your project.xml may be included by adding the ear.bundle.jar property to the properties, e.g.
<dependency>
  <id>CustomerEjb</id>
  <version>2.4</version>
  <properties>
    <ear.bundle.jar>true</ear.bundle.jar>
  </properties>
</dependency>