在使用maven時,修改插件tomcat啟動端口。一開始我在pom.xml配置文件里面修改,如下面所示:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<port>9999</port>
<uriEncoding>UTF-8</uriEncoding>
</configuration>
</plugin>
可是這樣的修改方法 并不起作用
后來在網(wǎng)上查找發(fā)現(xiàn)一種解法方法是挺管用的,而且很方便
直接在上述文章中的Goals值中的tomcat:run前邊加上-Dmaven.tomcat.port=8081即可,最終效果為
-Dmaven.tomcat.port=8081 tomcat:run
以上這篇使用Maven tomcat:run命令啟動web項目時修改默認端口的方法就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。