pom.xml
<build>
<finalName>webdemo</finalName>
<plugins>
<!-- 指定编译jdk为1.8 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<target>1.8</target>
<resource>1.8</resource>
</configuration>
</plugin>
<!-- tomcat7插件 -->
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<path>//${project.artifactId}</path>
<port>8080</port>
<uriEncoding>UTF-8</uriEncoding>
<finalName>${project.build.finalName}</finalName>
<!-- 名称必须与配置文件的id名称一致 -->
<server>tomcat7</server>
</configuration>
<!-- 在打包周期运行tomcat7 -->
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
命令 | 描述 |
---|---|
tomcat7:deploy | 部署一个web war包 |
tomcat7:reload | 重新加载web war包 |
tomcat7:start | 启动tomcat |
tomcat7:stop | 停止tomcat |
tomcat7:undeploy | 停止一个war包 |
tomcat7:run | 启动嵌入式tomcat ,并运行当前项目 |