[英]How to : Deploy to Tomcat *real* Server through Netbeans
How do you deploy a Java web app to Tomcat server, on another computer on network(or internet) , through an IDE like Netbeans for development/testing & production purposes ? 您如何通过NetBeans之类的IDE将Java Web应用程序部署到网络(或Internet)上另一台计算机上的Tomcat服务器上,以进行开发/测试和生产?
Any feature in Netbeans that makes this simpler ? Netbeans中的任何功能都可以使此操作更简单吗?
You can do this by modifying your build.xml. 您可以通过修改build.xml来实现。 You'll need
catalina-ant.jar
from the Tomcat distribution. 您将需要Tomcat发行版中的
catalina-ant.jar
。 I throw it in my build-jars directory - you can also place it in ANT_HOME/lib
. 我将其放在build-jars目录中-您也可以将其放在
ANT_HOME/lib
。 Here's what I have in my build.xml to deploy to a remote Tomcat: 这是我在build.xml中要部署到远程Tomcat的内容:
<property name="build-jars" location="build-jars" />
<property name="deploy" location="deploy" />
<property name="target.name" value="myapp" />
<property name="tomcat.manager.url" value="http://server.com:8080/manager/text"/>
<property name="tomcat.manager.username" value="user" />
<property name="tomcat.manager.password" value="pass" />
<taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask">
<classpath>
<path location="${build-jars}"/catalina-ant.jar" />
</classpath>
</taskdef>
<target name="deploy-war" depends="war" description="Deploy to Tomcat">
<deploy url="${tomcat.manager.url}"
username="${tomcat.manager.username}"
password="${tomcat.manager.password}"
path="/${target.name}"
update="true"
war="file:${deploy}/${target.name}.war" />
</target>
Note that in Tomcat 7 the user will need to have the manager-script role set in tomcat-users.xml. 请注意,在Tomcat 7中,用户将需要在tomcat-users.xml中设置manager-script角色。
Use the tomcat-maven-plugin. 使用tomcat-maven-plugin。 An in-IDE support is intended for localhost dev purposes only.
IDE中的支持仅用于localhost开发目的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.