Jey
Jey

Reputation: 31

ant task to deploy/undeploy war on jboss

How do i deploy/undeploy a war file on running Jboss server using ANT build ?

Upvotes: 2

Views: 7498

Answers (4)

Katie J. Ots
Katie J. Ots

Reputation: 883

JBoss AS7 has a deployment scanner enabled by default, so you can just copy the war file to ${jboss.home}/standalone/deployments and it will automatically be deployed, ie:

<copy file="${war.path}" todir="${jboss.home}/standalone/deployments"/>

Once the war is deployed, a file called ${war.filename}.war.deployed will appear in the deployments directory. To undeploy a war, delete the related .deployed file, ie:

<delete file="${jboss.deployments.dir}/${war.filename}.war.deployed"/>

Once the war has been undeployed, there will be a file called ${jboss.deployments.dir}/${war.filename}.war.undeployed in the deployments directory.

To prompt a redeployment, you can either delete the .undeployed file, or create a file with the same name as the war and a .dodeploy extension, ie:

<touch file="${jboss.deployments.dir}/${war.filename}.war.dodeploy"/>

This StackOverflow post has an example of an Ant task for an undeploy followed by a deploy.

Obviously, for the above to work you need to declare the various properties used somewhere, ie:

<property name="war.filename" value="mywar" />
<property name="war.path" value="dir/mywar.war" />
<property name="jboss.deployments.dir" value="${jboss.home}/standalone/deployments" />

Upvotes: 5

Vadzim
Vadzim

Reputation: 26170

You can just

<copy file="${war.path}" todir="${jboss.home}/server/default/deploy"/>

Upvotes: 0

Aditya
Aditya

Reputation: 451

The answer depends on the version of JBoss used by you.However you can you cargo library for deploying/undeploying your application in JBoss.

For more info on cargo refer to : Cargo Ant support

Upvotes: 0

JoseK
JoseK

Reputation: 31371

Take a look at the JBoss Web Client Deployer

The deployer is not packaged with the JBoss Web core distribution, and must therefore be downloaded separately from the Downloads area. The download is usually labelled jbossweb-2.1.x-deployer

I have not used this myself

Upvotes: 0

Related Questions