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

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命令,

原文地址:https://www.cnblogs.com/SunAutumn/p/10076836.html