Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 13 Next »

Definition

Deployables are archives (WAR, EAR, etc) that can be deployed in the container

Explanation

A Deployable class is a wrapper class around a physical archive. Deployable are constructed by directly instantiating them (e.g. new WAR(...) or new TomcatWAR(...)) or by using a DeployableFactory (e.g. DefaultDeployableFactory). There are 2 generic deployable classes:

  • o.c.c.c.deployable.WAR
  • o.c.c.c.deployable.EAR
    There are also some container-specific deployables such as:
  • o.c.c.c.deployable.tomcat.TomcatWAR
  • o.c.c.c.deployable.jboss.JBossWAR
    They are there to support container extensions to archives (for example, Tomcat supports context.xml files located in your WAR's META-INF directory, JBoss allows for a jboss-web.xml located in your WAR, etc).

The DeployableFactory interface offers a principal method for creating a Deployable: DeployableFactory.createDeployable(String containerId, String deployableLocation, DeployableType type). DeployableType can be DeployableType.WAR or DeployableType.EAR.

Once you have a Deployable instance wrapping your archive, you'll need to deploy it. This can be done either using Static Deployment or using Hot Deployment.

Example using the Java API

Deploying a WAR in Tomcat 5.x:

Example using the Generic API

Example using the Ant API

Statically deploying a WAR in Tomcat 5.x:

Example using the Maven 2 plugin

Careful with the <configuration> elements!

Icon

The Maven2 plugin has two <configuration> elements:

  • The first (outer) one is the plugin's configuration
  • The second (inner) one is the container's configuration

The <deployables> element should be in the inner <configuration> element.

  • No labels