如何使用Maven将WAR文件部署到Tomcat? [英] How to deploy WAR file to Tomcat using Maven?
本文介绍了如何使用Maven将WAR文件部署到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]安装C:\Directory\\\
ame。战争到C:\Directory\\\
ame.war
[INFO]将C:\Directory\pom.xml安装到C:\Directory\\\
ame.pom
正如你所看到的,我想配置这一行:
至 C:\Directory\\\
ame.war
如何将其指向Tomcat / webapps文件夹?
解决方案
< 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 /
I'm using Maven in my Java project and I want to deploy the WAR to my localhost Tomcat.
I have this lines in my pom.xml
file:
<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>
The output logs are:
[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
As you can see I want to config this line:
to C:\Directory\name.war
How to point it to Tomcat's /webapps folder?
解决方案
<configuration>
<url>http://127.0.0.1:8080/manager</url>
<server>TomcatServer</server>
<path>/mkyongWebApp</path>
</configuration>
check the link http://www.mkyong.com/maven/how-to-deploy-maven-based-war-file-to-tomcat/
这篇关于如何使用Maven将WAR文件部署到Tomcat?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文