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.

Maven J2EE Appserver Control

This page offers some general information about the appserver control features of the J2EE plug-in. Specific details about related targets and their properties can be found elsewhere.

Plug-in Rationale

When developing a web application (or website for that matter), each developer working on the project needs to have an environment to run and test their application. Rather than store a complete application server install in source control, it is much more feasible to have a centralized install of that application server. Then, using only the minimum configuration files the developer can control a separate isolated instance of the application server on their machine.

The Maven J2EE plug-in appserver features use this technique to install and control application server instances for your project needs. The appserver features are not for deploying webapps or war files into application servers.

Supported Servers

The following table shows the various appserver versions that are supported by the appserver control features of the Maven J2EE plug-in and what propety values are required to be set in order for the maven:appserver-* targets to work with those versions.

Server ${maven.appserver.name} ${maven.appserver.version} ${maven.j2ee.version}
Tomcat 4.x tomcat 40 12 or 13
Orion 2.0.x orion 2.0.x

The following application servers are expected to be supported soon:

Appserver Proxy Build File

To make life even easier when using the appserver targets, the Maven J2EE plug-in includes a proxy build file. This means a file similar to the one below is copied to the directory specified by ${maven.appserver.dir}.

${maven.appserver.dir}/build.xml
      <?xml version="1.0"?>
        <project name="Maven Application Server Plugin Proxy" default="install"
        basedir="@basedir@">

        <!-- ================================================================== -->
        <!-- Proxy for controlling an installed application server instance     -->
        <!-- ================================================================== -->

        <!-- ========================================================== -->
        <!-- Give user a chance to override without editing this file   -->
        <!-- (and without typing -D each time they compile)             -->
        <!-- ========================================================== -->
        <!-- all ant projects specific properties                       -->
        <property file="${user.home}/build.properties" />
        <!-- project/user specific settings                             -->
        <property file="@basedir@/build.properties" />
        <!-- anything here is expected to be project defaults           -->
        <property file="@basedir@/project.properties" />
        <!-- ========================================================== -->

        <target name="install">
          <ant antfile="${maven.home}/plugins/j2ee/build.xml"
            target="appserver-install" />
        </target>

        <target name="start">
        <ant antfile="${maven.home}/plugins/j2ee/build.xml"
          target="appserver-start" />
        </target>

        <target name="stop">
        <ant antfile="${maven.home}/plugins/j2ee/build.xml"
          target="appserver-stop" />
          </target>

        </project>
      

Using this build file, you can run the appserver related targets quickly from within your ${maven.appserver.dir} directory. Typing simply

ant

can stop, re-install, and re-start a started server instance.