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

    xiaoxiao2021-03-25  81

    在使用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
    转载请注明原文地址: https://ju.6miu.com/read-12267.html

    最新回复(0)