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

使用Maven tomcat:run命令启动web项目时修改默认端口

2017-03-09 14:59 681 查看
在使用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>

可是这样的修改方法 并不起作用

后来在网上查找发现一种解法方法是挺管用的,而且很方便

直接在上述文章中的Goals值中的tomcat:run前边加上-Dmaven.tomcat.port=8081即可,最终效果为

-Dmaven.tomcat.port=8081 tomcat:run
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  tomcat maven web