ant task to deploy/undeploy war on jboss
How do i deploy/undeploy a war file o开发者_如何学运维n running Jboss server using ANT build ?
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" />
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
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
You can just
<copy file="${war.path}" todir="${jboss.home}/server/default/deploy"/>
精彩评论