This plugin provides support for J2EE applications which run either in a servlet or in an EJB container. It allows creating packages of the specific format and delivers targets to control the different servers. The plugin has four distinct parts:
The following presents each of them.
Remark: The multi environment support simplifies the usage of this plugin because it homogenizes among different web and EJB containers respectively. Using the environment support moves all attributes into property files and the plugins are declared using two special properties within the product-specific property file. See PluginEnvironment for details.
This plugin provides support to generate a J2EE WAR file (web archive with .war
extension). The content of the WAR must be stored in the webapp/
directory
of modules.
<plugin name="j2ee-war"> <attribute name="j2ee-war.jar.excludes" value="servlet-api-*.jar"/> </plugin>
runtime
, automatically included if not explicitly declared.
If your module or module execution unit can be deployed as a WAR, the following
attribute is needed to create the archive module-eu.war
(or module.war
if no
execution unit)
<attribute name="j2ee.war.application" value=""/>
If you want your WAR application name to be mywebapp
, then you can set
the j2ee.war.application
attribute to that value. The archive mywebapp.war
will be generated by the create.war
target.
<attribute name="j2ee.war.application" value="mywebapp"/>
The module dependency order is used to copy files with the same name in
different webapp/
directories. If A
depends on B
, A/webapp/file.html
replaces B/webapp/file.html
in the WAR.
To speed up WAR generation, you can set the global attribute
j2ee-war.unpacked
to true. Instead of adding execution unit jar file in
WEB-INF/lib
(equivalent to the runtime classpath), it aggregates the
classes/
directory content into WEB-INF/classes
(equivalent to the
development runtime classpath, not execution-unit aware). In that case, the
whole module content (classes and resources) are available in the WAR file
without considering execution unit filters.
Warning: the target create.war
assumes your project compilation is up-to-date
in case j2ee-war.unpacked
is true, or else your project jars are up-to-date.
From the command line, it is wiser to invoke
ant compile create.war.module.eu.mymodule.myeu
or
ant jars create.war.module.eu.mymodule.myeu
.
create.war.module.eu
generates the execution unit WAR for a module
without compiling or building jars before. Shortcuts are generated.
create.wars
generates the WAR for all supported execution units. It
calls create.war.module.eu
.
j2ee-war.unpacked
may be set to true to aggregate module classes
directory in WEB-INF/classes
instead of using execution unit jars
(included in WEB-INF/lib
in that case). Default is false
.
j2ee-war.jar.excludes
is a Ant exclusion filter to prevent some jar
files to be included in WEB-INF/lib
directory.
j2ee.war.application
marks the module execution unit to enable WAR
generation. If the attribute has empty string value, the name of the
module execution unit is used as application name by default.
j2ee-war.jar.excludes
is the module execution unit specific filter,
appended to the global attributes, when the WAR is generated for the
concerned module.
pre.war.[module].[eu]
and post.war.[module].[eu]
called in
create.war.module.eu
This plugin directly extends j2ee-war
with Tomcat support. It provides
targets to start and stop Tomcat and to deploy or update a WAR as a Tomcat
application. It has been tested with versions 4.1.30 and 5.0.27.
runtime
, automatically included if not explicitly declared.
j2ee-war
, automatically included if not explicitly declared.
<plugin name="j2ee-web-tomcat"> <attribute name="j2ee-web.container" value="tomcat"/> <attribute name="j2ee-web.home" value="../jakarta-tomcat-5.0.27"/> <attribute name="j2ee-web.host" value="localhost"/> <attribute name="j2ee-web.port" value="8080"/> <attribute name="j2ee-web.manager.username" value="admin"/> <attribute name="j2ee-web.manager.password" value="password"/> <attribute name="j2ee-web-tomcat.baseurl" value="http://localhost:8080"/> </plugin>
You have to specify where your Tomcat server is installed and the
username/password of a user defined in conf/tomcat-users.xml
with role
manager
to enable application reloading.
The module configuration must be done as described in the j2ee-war
plugin
documentation. In addition, the attribute runtime.command.creator
is
automatically added by the plugin for the concerned execution unit which
enables to start tomcat during application deployment.
When you're developing your WAR content in module webapp/
directories (HTML,
JSP, ...), you may want to speed up the WAR deployment with the unpacked flag
(WEB-INF/classes
) and the directory
mode (the WAR is not packed) by adding
the following two plugin attributes:
<plugin name="j2ee-web-tomcat"> <attribute name="j2ee-war.unpacked" value="true"/> <attribute name="j2ee-web.mode" value="directory"/> [...]
deploy.war.module.eu
deploys the execution unit WAR content in Tomcat webapps/
directory, starts Tomcat (without runtime hooks) if needed or else asks
for application reloading. If
the target has started Tomcat, it goes on running until Ctrl-C
is hit.
Shortcuts are generated
runtime.command.creator.web
is the runtime command creator used to
start Tomcat.
start.web
starts Tomcat which goes on running until Ctrl-C
is hit or until
stop.web
is executed.
stop.web
stops the running Tomcat instance.
j2ee-web.home
is the directory where the Tomcat server is installed.
Mandatory, no default value.
j2ee-web.host
is the Tomcat server's host name or IP address.
Mandatory, no default value.
j2ee-web.port
is the Tomcat server configuration port.
Mandatory, no default value.
j2ee-web.manager.username
is the username of a user with
manager
role in Tomcat users. Mandatory, no default value.
j2ee-web.manager.password
is the password of the previously
defined username. Mandatory, no default value.
j2ee-web.mode
may set to directory
, war
or
war+directory
. If the mode contains directory
, the WAR content is
copied in applications/appname/
. If the mode contains war
, the file
applications/appname.war
is packed. Default value is war
.
j2ee-war-tomcat.baseurl
is the Tomcat server configuration URL. Optional, the
default value is http://<j2ee-web.host>:<j2ee-web.port>
WEB-INF/classes
with exact execution-unit aware content
This plugin directly extends j2ee-war
with WebLogic Server support. It
provides targets to start WLS and to deploy or update a WAR in WLS. It has been
tested with WebLogic Server 8.1.
runtime
, automatically included if not explicitly declared.
j2ee-war
, automatically included if not explicitly declared.
<plugin name="j2ee-web-weblogic" file="buildsystem/j2ee/war-weblogic.xml"> <attribute name="j2ee-web.container" value="weblogic"/> <attribute name="j2ee-war.unpacked" value="true"/> <attribute name="j2ee-web.mode" value="war"/> <attribute name="j2ee-web.home" value="../external-tools/weblogic"/> <attribute name="j2ee-web.host" value="localhost"/> <attribute name="j2ee-web.port" value="7001"/> <attribute name="j2ee-web.manager.username" value="weblogic"/> <attribute name="j2ee-web.manager.password" value="password"/> <attribute name="j2ee-web-weblogic.beahome" value="../../bea"/> <attribute name="j2ee-web-weblogic.domain" value="../external-tools/domains/mydomain"/> <attribute name="j2ee-web-weblogic.server" value="myserver"/> </plugin>
The following configuration expects many things from the WLS installation:
j2ee-web.home
j2ee-web-weblogic.beahome
j2ee-web-weblogic.domain
j2ee-web-weblogic.server
7001
in j2ee-web.port
j2ee-web.manager.username
and
j2ee-web.manager.password
.
Moreover, the WebLogic domain must have been configured in development mode to enable automatic update of the application.
deploy.war.module.eu
deploys the execution unit WAR content in the WLS
domain applications/
directory and starts the server if needed. If the
target has started WLS, it goes on running until Ctrl-C
.
Shortcuts are generated
runtime.command.creator.web
is the runtime command creator used to
start WebLogic Server.
start.web
starts WebLogic which goes on running until Ctrl-C
or until
stop.web
is executed.
stop.web
stops the running WebLogic instance.
j2ee-web.home
is the directory where the Weblogic server is
installed. Mandatory, no default value.
j2ee-web-weblogic.beahome
is the BEA home directory. Mandatory, no
default value.
j2ee-web-weblogic.domain
is the WebLogic domain directory where the
configuration can be found. Mandatory, no default value.
j2ee-web-weblogic.server
is the WebLogic server name configured in the
previously defined domain. Mandatory, no default value.
j2ee-web.host
is the Weblogic server's host name or IP address.
Mandatory, no default value.
j2ee-web.port
is the Weblogic server configuration port.
Mandatory, no default value.
j2ee-web.manager.username
is the domain administrator username
in Weblogic users. Mandatory, no default value.
j2ee-web.manager.password
is the password of the previously
defined username. Mandatory, no default value.
j2ee-web.mode
may set to directory
, war
or
war+directory
. If the mode contains directory
, the WAR content is
copied in applications/appname/
. If the mode contains war
, the file
applications/appname.war
is packed. Default value is war
.
WEB-INF/classes
with exact execution unit
aware content
This plugin provides support to generate a J2EE EAR file (enterprise archive with .ear extension).
<plugin name="j2ee-ear"> <attribute name="j2ee-ear.jar.excludes" value="j2ee-*.jar"/> </plugin>
runtime
, automatically included if not explicitly declared.
If your module or module execution unit can be deployed as an EAR, the following
attribute is needed to create the archive module-eu.ear
(or module.ear
if no
execution unit)
<attribute name="j2ee.ear.application"/>
Warning: the target create.ear
assumes your project compilation is up-to-date
in case j2ee-ear.unpacked
is true, or else your project jars are up-to-date.
From the command line, it is wiser to invoke
ant compile create.ear.module.eu.mymodule.myeu
or
ant jars create.ear.module.eu.mymodule.myeu
.
create.ear.module.eu
generates the execution unit EAR for a module
without compiling or building jars before. Shortcuts are generated.
create.ears
generates the EAR for all supported execution units. It
calls create.ear.module.eu
.
j2ee-ear.jar.excludes
is a Ant exclusion filter to prevent some jar
files to be included.
j2ee.ear.application
marks the module execution unit to enable EAR
generation. If the attribute has no value, the name of the module
execution unit is used as application name by default.
j2ee-ear.jar.excludes
is the module execution unit specific filter,
appended to the global attributes, when the EAR is generated for the
concerned module.
j2ee.ear.dd
points to the ear deployment descriptor file.
pre.ear.[module].[eu]
and post.ear.[module].[eu]
called in
create.ear.module.eu
This plugin directly extends j2ee-ear
with JBoss support. It provides
targets to start and stop JBoss and to deploy or update an EAR as a EJB
application. It has been tested with version 4.0.2.
runtime
, automatically included if not explicitly declared.
j2ee-ear
, automatically included if not explicitly declared.
<plugin name="j2ee-ejb-jboss"> <attribute name="j2ee-ejb.container" value="jboss"/> <attribute name="j2ee-ejb.home" value="../external-tools/jboss"/> <attribute name="j2ee-ejb.host" value="localhost"/> <attribute name="j2ee-ejb.port" value="1099"/> <attribute name="j2ee-ejb-jboss.deploypath" value="../external-tools/jboss/server/default/deploy"/> </plugin>
You have to specify where your JBoss server is installed. The module configuration
must be done as described in the j2ee-ear
plugin documentation. In addition,
the attribute runtime.command.creator
is automatically added by the plugin for
the concerned execution unit which enables to start JBoss during application deployment.
deploy.ear.module.eu
deploys the execution unit EAR content to JBoss.
Shortcuts are generated
runtime.command.creator.ejb
is the runtime command creator used to
start JBoss.
start.ejb
starts JBoss which goes on running until Ctrl-C
is hit or until
stop.ejb
is executed.
stop.ejb
stops the running JBoss instance.
j2ee-ejb.home
is the directory where the WebLogic server is installed.
Mandatory, no default value.
j2ee-ejb.host
is the JBoss server's name or IP address.
Mandatory, no default value.
j2ee-ejb.port
is the WebLogic server configuration port.
Mandatory, no default value.
j2ee-ejb-jobss.deploypath
is the path where EARs are copied to during
deployment.
This plugin directly extends j2ee-ear
with WebLogic support. It provides
targets to start and stop WebLogic and to deploy or update an EAR as a EJB
application. It has been tested with version 8.1.
runtime
, automatically included if not explicitly declared.
j2ee-ear
, automatically included if not explicitly declared.
<plugin name="j2ee-ejb-weblogic"> <attribute name="j2ee-ejb.container" value="weblogic"/> <attribute name="j2ee-ejb.home" value="../external-tools/weblogic"/> <attribute name="j2ee-ejb.host" value="localhost"/> <attribute name="j2ee-ejb.port" value="7001"/> <attribute name="j2ee-ejb.manager.username" value="weblogic"/> <attribute name="j2ee-ejb.manager.password" value="password"/> <attribute name="j2ee-ejb-weblogic.beahome" value="../../bea"/> <attribute name="j2ee-ejb-weblogic.domain" value="../external-tools/domains/mydomain"/> <attribute name="j2ee-ejb-weblogic.server" value="myserver"/> </plugin>
You have to specify where your WebLogic server is installed. The module configuration
must be done as described in the j2ee-ear
plugin documentation. In addition,
the attribute runtime.command.creator
is automatically added for the concerned
execution unit to be able to start WebLogic when deploying.
deploy.ear.module.eu
deploys the execution unit EAR content to WebLogic.
Shortcuts are generated
runtime.command.creator.ejb
is the runtime command creator used to
start WebLogic.
start.ejb
starts WebLogic which goes on running until Ctrl-C
is hit or until
stop.ejb
is executed.
stop.ejb
stops the running WebLogic instance.
j2ee-ejb.home
is the directory where the Weblogic server is
installed. Mandatory, no default value.
j2ee-ejb-weblogic.beahome
is the BEA home directory. Mandatory, no
default value.
j2ee-ejb-weblogic.domain
is the WebLogic domain directory where the
configuration can be found. Mandatory, no default value.
j2ee-ejb-weblogic.server
is the WebLogic server name configured in the
previously defined domain. Mandatory, no default value.
j2ee-ejb.host
is the Weblogic server's host name or IP address.
Mandatory, no default value.
j2ee-ejb.port
is the Weblogic server configuration port.
Mandatory, no default value.
j2ee-ejb.manager.username
is the domain administrator username
in Weblogic users. Mandatory, no default value.
j2ee-ejb.manager.password
is the password of the previously
defined username. Mandatory, no default value.
Move from custom Ant scripts to Cargo, which unifies the control (start, stop, deploy) of different J2EE containers. There's currently no support for JBoss (work in progress and planned for next release, 0.7).