标签:maven
tomcat7-maven-plugin插件的pom.xml依赖为:
<dependency> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.2</version> </dependency>
<plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.2</version> <configuration> <path>/taobao</path> <port>9090</port> <uriEncoding>UTF-8</uriEncoding> </configuration> </plugin>
访问 http://127.0.0.1:9090/taobao 即可访问
二:部署项目到tomcat
首先,在conf/tomcat-users.xml 文件里面配置
<role rolename="manager-gui"/> <user username="admin" password="123456" roles="manager,manager-gui"/>
两种方法部署
(1)
直接在pom.xml里面配置插件
<plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.2</version> <configuration> <path>/taobao</path> <url>http://127.0.0.1:8080/manager/text</url> <username>admin</username> <password>123456</password> </configuration> </plugin>
(2)
<plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.2</version> <configuration> <uriEncoding>UTF-8</uriEncoding> <url>http://127.0.0.1:8080/manager/text</url> <server>tomcat7</server> </configuration> </plugin>
<server> <id>tomcat7</id> <username>admin</username> <password>123456</password> </server>
最后,执行 mvn tomcat7:deploy即可部署
访问地址为:http://127.0.0.1:8080/taobao
maven技术交流 扣扣群 379165311,群里面会不定期分享一些maven文章和教程,欢迎大家加入
版权声明:本文为博主原创文章,未经博主允许不得转载。
maven插件介绍之tomcat7-maven-plugin
标签:maven
原文地址:http://blog.csdn.net/mn960mn/article/details/47066649