简体   繁体   中英

How to use Ant and build.xml to deploy .war folder?

What is/are the ant commands in build.xml to deploy a .war file as a folder on a JBoss AS 5.1 web server?

When I run JBoss AS from JBoss Developer studio, it deploys a .war folder into the /deploy folder of JBoss AS for my web service, and everything deploys nicely - which is exactly what I want to do, but with a build.xml file using ant instead. However when I use ant and a build.xml file with the commands below to deploy, it merely adds a .war file instead of a folder, which in turn fails the deployment:

  <target name="deploy">
      <war destfile="build/MyWebService.war" webxml="WebContent/WEB-INF/web.xml">
         <classes dir="build/classes"/>
      </war>
      <copy file="build/MyWebService.war" todir="${jboss.home}/deploy"/>
  </target>

Surely there is a nice easy bit of code that I can put into my build.xml that mimics the deployment of the .war folder in JBoss AS when it is started? Does anyone know?

Not sure I understand the problem, but you could just tell ant to unzip the war file. (http://ant.apache.org/manual/Tasks/unzip.html)

I've never used JBoss, but I would have expected it to automatically pick up the war file and unpack it itself.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM