maven默認是使用tomcat6跑項目的,這段是讓maven用tomcat7去跑
在pom.xml中添加
<build> <!-- we dont want the version to be part of the generated war file name --> <finalName>${project.artifactId}</finalName> <defaultGoal>compile</defaultGoal> <plugins> <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId><span style="white-space:pre;"> </span><!--使用tomcat7運行--><span style="white-space:pre;"> </span> <version>2.2</version> <configuration> <port>8082</port><span style="white-space:pre;"> </span><!--運行端口--> <!-- <path>/mgr</path> --> <uriEncoding>UTF-8</uriEncoding> <finalName>mgr</finalName> <path>/KBase</path><span style="white-space:pre;"> </span><!--項目名--> <server>tomcat7</server><span style="white-space:pre;"> </span> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <skip>true</skip> </configuration> </plugin> </plugins> </build>
以上這篇Maven 修改tomcat運行版本和端口的實現(xiàn)方法就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持腳本之家。