简体   繁体   English

如何使用Ant和build.xml部署.war文件夹?

[英]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? build.xml中的ant命令是什么,用于将.war文件部署为JBoss AS 5.1 Web服务器上的文件夹?

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. 当我从JBoss Developer Studio运行JBoss AS时,它将一个.war文件夹部署到我的Web服务的JBoss AS的/ deploy文件夹中,并且一切都部署得很好-正是我想要做的,但是带有build.xml文件使用蚂蚁代替。 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: 但是,当我在下面的命令中使用ant和build.xml文件进行部署时,它仅添加了.war文件而不是文件夹,这反过来导致部署失败:

  <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? 当然,可以在我的build.xml中放入一些简单的代码来模拟JBoss AS启动时.war文件夹中的部署。 Does anyone know? 有人知道吗?

Not sure I understand the problem, but you could just tell ant to unzip the war file. 不确定我是否理解问题,但是您可以告诉ant解压缩war文件。 (http://ant.apache.org/manual/Tasks/unzip.html) (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. 我从未使用过JBoss,但我希望它能够自动提取war文件并解压缩。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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