您的位置:首页 > 运维架构 > Tomcat

maven使用内嵌tomcat7

2016-06-22 16:35 225 查看
在web项目的pom.xml中添加如下:

<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
<configuration>
<port>8080</port>
<path>/web</path>
<uriEncoding>UTF-8</uriEncoding>
<finalName>web</finalName>
<server>tomcat7</server>
</configuration>
</plugin>
</plugins>
</build>


然后项目右键--run as -- maven build -- 输入参数 tomcat7:run。需要的构件下载完成后即可通过http://localhost:8080/web访问项目





该插件可以远程部署web项目,常用命令有:

命令描述
tomcat7:deploy部署一个web war包
tomcat7:reload重新加载web war包
tomcat7:start

启动tomcat
tomcat7:stop

停止tomcat
tomcat7:undeploy

停止一个war包
tomcat7:run启动嵌入式tomcat ,并运行当前项目
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: