/
Deployable
Deployable
Definition
Deployables are archives (WAR, EAR, etc) that can be deployed in the containerExplanation
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 supportscontext.xml
files located in your WAR'sMETA-INF
directory, JBoss allows for ajboss-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:
Container container = new Tomcat5xContainer( new CatalinaStandalineConfiguration("target/tomcat5x")); container.setHome("c:/apps/tomcat-5.0.29"); WAR war = new WAR("path/to/my.war"); [...]
Example using the Generic API
[...] DeployableFactory factory = new DefaultDeployableFactory(); WAR war = factory.createDeployable("tomcat5x", "path/to/my.war", DeployableType.WAR);
Example using the Ant tasks
Statically deploying a WAR in Tomcat 5.x:
<cargo containerId="tomcat5x" home="c:/apps/tomcat-5.0.29" action="start"> <configuration> <war warfile="path/to/my.war"/> </configuration> </cargo>
Example using the Maven 3 plugin
<dependencies> [...] <dependency> <groupId>my.war.groupId</groupId> <artifactId>my-war</artifactId> <version>1.0.0</version> <packaging>war</packaging> </dependency> [...] </dependencies> [...] <plugins> [...] <plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven3-plugin</artifactId> <configuration> <container> [...] </container> <configuration> <type>standalone</type> [...] </configuration> <deployables> <deployable> <groupId>my.war.groupId</groupId> <artifactId>my-war</artifactId> <type>war</type> </deployable> </deployables> </configuration> </plugin> </plugins>
, multiple selections available,
Related content
Deployer
Deployer
Read with this
Static deployment of expanded WAR
Static deployment of expanded WAR
More like this
Hot Deployment
Hot Deployment
Read with this
Deploying legacy WARs to Tomcat 10.x onwards
Deploying legacy WARs to Tomcat 10.x onwards
More like this
Configuration files option
Configuration files option
Read with this
Static deployment of WAR
Static deployment of WAR
More like this