1、maven插件运行tomcat【tomcat7-maven-plugin】
<plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.2</version> <configuration> <port>8080</port> <path>/test</path> <uriEncoding>UTF-8</uriEncoding> </configuration> </plugin>
常用命令:
tomcat7:run
2、maven插件打war包【maven-war-plugin】
<!-pom.xml顶部设置打包类型->
<packaging>war</packaging>
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.4</version> <configuration> <webappDirectory>${project.build.directory}/${project.artifactId}</webappDirectory> <warName>${project.artifactId}</warName> </configuration> </plugin>
(1)在eclipse中不添加 maven-war-plugin 直接运行package也能打包成功,可能eclipse集成了该插件吧。
(2)project.build.directory、project.artifactId不需要定义