代码改变世界

使用maven中的tomcat插件启动项目

2018-12-06 15:12  如是我所闻  阅读(1338)  评论(0编辑  收藏  举报

1 pom.xml中配置tomcat 插件

 <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <hostName>localhost</hostName>    <!--   Default: localhost -->
                    <port>8080</port>    <!-- 启动端口 Default:8080 -->
                    <path>/HM-company-wx</path>    <!-- 访问应用路径  Default: /${project.artifactId}-->
                    <uriEncoding>UTF-8</uriEncoding>      <!-- uri编码 Default: ISO-8859-1 -->
                </configuration>
            </plugin>

2 配置命令 tomcat7:run-war

note:由于本项目是web项目,所以用的run-war命令,