maven集成tomcat7

只要在pom.xml文件中添加如下代码:

<build>
		<plugins>
			<!-- 配置Tomcat方便运行 -->
			<plugin>
				<groupId>org.apache.tomcat.maven</groupId>
				<artifactId>tomcat7-maven-plugin</artifactId>
				<version>2.1</version>
				<configuration>
					<port>8082</port>
					<path>/train</path>
					<protocol>org.apache.coyote.http11.Http11NioProtocol</protocol>
					<uriEncoding>utf-8</uriEncoding>
					<backgroundProcessorDelay>2</backgroundProcessorDelay>
				</configuration>
			</plugin>
		</plugins>
	</build>

 再运行mvn tomcat7:run 或mvn tomcat7:run-war推荐使用后者

停止mvn tomcat7:stop

你可能感兴趣的:(maven)