天天看点

【Maven笔记】07:Maven创建、部署Web工程

部署Web工程:war

通过maven直接部署运行web项目:

a.配置cargo

b. maven命令:deploy

实际开发中,开发人员 将自己的项目开发完毕后,打成war包(package) 交给实施人员去部署;

<build>	<finalName>WebProjectName</finalName>
		<plugins>
			<plugin>
				<groupId>org.codehaus.cargo</groupId>
				<artifactId>cargo-maven2-plugin</artifactId>
				<version>1.4.9</version>
				<configuration>
					<container>
						<containerId>tomcat8x</containerId>
						<home>D:\study\apache-tomcat-8.5.30</home>
					</container>
					<configuration>
						<type>existing</type>
						<home>D:\study\apache-tomcat-8.5.30</home>
						<!-- 默认值8080 -->
						<properties>
							<cargo.servlet.port>8888</cargo.servlet.port>
						</properties>
					</configuration>
				</configuration>
				<executions>  
					<execution>  
						<id>cargo-run</id>  
						<phase>install</phase>  
						<goals>  
							<goal>run</goal>  
						</goals>  
					</execution>  
				</executions>
			</plugin>
		</plugins>
	</build>