我在我的Java项目中使用Maven,我想将WAR部署到我的localhost Tomcat。
我在pom.xml
文件中有这些行:
<properties>
<tomcat.target>C:\Directory</tomcat.target>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<webappDirectory>${tomcat.target}</webappDirectory>
</configuration>
</plugin>
</plugins>
</build>
输出日志为:
[INFO] --- maven-install-plugin:2.3.1:install (default-install) ---
[INFO] Installing C:\Directory\name.war to C:\Directory\name.war
[INFO] Installing C:\Directory\pom.xml to C:\Directory\name.pom
如您所见,我想配置此行:
到 C:\ Directory \ name.war
如何将其指向Tomcat的/ webapps文件夹?
答案 0 :(得分:2)
<configuration>
<url>http://127.0.0.1:8080/manager</url>
<server>TomcatServer</server>
<path>/mkyongWebApp</path>
</configuration>
检查链接http://www.mkyong.com/maven/how-to-deploy-maven-based-war-file-to-tomcat/
答案 1 :(得分:0)
<project>
...
<build>
...
<plugins>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.2-SNAPSHOT</version>
<configuration>
<url>http://www.example.com:1234/mymanager</url>
</configuration>
</plugin>
...
</plugins>
...
</build>
...
</project>
请参阅usage page。
答案 2 :(得分:0)
如果您使用netbeans将此添加到您的pom
<properties>
<netbeans.hint.deploy.server>Tomcat70</netbeans.hint.deploy.server>
</properties>
或者您可以使用这些链接http://winfig.com/?p=76和http://www.avajava.com/tutorials/lessons/how-do-i-deploy-a-maven-web-application-to-tomcat.html