maven jetty/tomcat/wildfly plugin部署应用到本地容器

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>1.0.0</modelVersion>

	<parent>
		<artifactId>demo</artifactId>
		<groupId>com.***.***</groupId>
		<version>1.0</version>
	</parent>

	<artifactId>smp-portal</artifactId>
	<version>4.0</version>
	<packaging>war</packaging>

	<name>portal</name>
	<url>http://maven.apache.org</url>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<activiti.version>5.14</activiti.version>
	</properties>

	<build>
		<plugins>
		        <!-- 此处为jetty,集成了jrebel热部署 -->
		        <!-- 需要自定义run config参数:-noverify -javaagent:E:/home/jrebel5.4.2/jrebel.jar-->
			<plugin>
				<groupId>org.eclipse.jetty</groupId>
				<artifactId>jetty-maven-plugin</artifactId>
				<version>9.1.4.v20140401</version>
				<configuration>
					<webAppConfig>
						<!-- 指定 root context 在这里指定为${project.artifactId} 即 jetty, 那么访问时就用http://localized:8080/jetty 访问, 如果指定梶为test 就用http://localized:8080/test访问,更多信息,请查看jetty 插件官方文档 -->
						<contextPath>/portal</contextPath>
					</webAppConfig>
					<!-- 指定额外需要监控变化的文件或文件夹,主要用于热部署中的识别文件更新 -->
					<scanTargetPatterns>
						<scanTargetPattern>
							<directory>src</directory>
							<includes>
								<include>*.java</include>
								<include>*.properties</include>
								<include>*.jsp</include>
								<include>*.js</include>
								<include>*.css</include>
							</includes>
							<!-- <excludes> <exclude>**/*.xml</exclude> <exclude>**/myspecial.properties</exclude> </excludes> -->
						</scanTargetPattern>
					</scanTargetPatterns>
					<!-- 指定监控的扫描时间间隔,0为关闭jetty自身的热部署,主要是为了使用jrebel -->
					<scanIntervalSeconds>0</scanIntervalSeconds>
					<!-- 指定web页面的文件夹 -->
					<webAppSourceDirectory>portal/src/main/webapp</webAppSourceDirectory>
				</configuration>
			</plugin>
                        <!-- 集成的jrebel -->
			<plugin>
				<groupId>org.zeroturnaround</groupId>
				<artifactId>jrebel-maven-plugin</artifactId>
				<version>1.1.5</version>
				<configuration>
					<alwaysGenerate>true</alwaysGenerate>
					<addResourcesDirToRebelXml>true</addResourcesDirToRebelXml>
					<showGenerated>true</showGenerated>
				</configuration>

				<executions>
					<execution>
						<id>generate-rebel-xml</id>
						<phase>process-resources</phase>
						<goals>
							<goal>generate</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

			<!-- 此处为cargo集成wildfly(jboss)-->
			<plugin>
				<groupId>org.codehaus.cargo</groupId>
				<artifactId>cargo-maven2-plugin</artifactId>
				<version>1.4.8</version>
				<configuration>
					<container>
						<containerId>wildfly8x</containerId>
						<type>installed</type>
						<home>E:/Program Files/wildfly-8.0.0.Final</home>
						<timeout>200000</timeout>
					</container>
					<configuration>
						<type>existing</type>
						<home>E:/Program Files/wildfly-8.0.0.Final/standalone</home>
						<properties>
							<cargo.jvmargs>
								<!-- 此处可定义jvm参数,可以自定义一些系统中需要的参数,比如我定义一个本地插件的位置:-Droot.dir=E:\wps-git\***\plugins\ -->
								-Xdebug
								-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8080
								-Xnoagent
								-Djava.compiler=NONE
								-Djboss.node.name=smpNode
							</cargo.jvmargs>
							<cargo.jboss.configuration>standalone</cargo.jboss.configuration>
							<cargo.hostname>localhost</cargo.hostname>
							<cargo.jboss.management-native.port>9999</cargo.jboss.management-native.port>
						</properties>
					</configuration>
					<deployer>
						<type>installed</type>
					</deployer>
					<deployables>
						<deployable>
							<groupId>com.***.***</groupId>
							<artifactId>portal</artifactId>
							<type>war</type>
							<pingURL>http://localhost:8080/portal</pingURL>
							<pingTimeout>200000</pingTimeout>
						</deployable>
					</deployables>
				</configuration>
				<executions>
					<execution>
						<id>start-container</id>
						<phase>pre-integration-test</phase>
						<goals>
							<goal>start</goal>
						</goals>
					</execution>
					<execution>
						<id>stop-container</id>
						<phase>post-integration-test</phase>
						<goals>
							<goal>stop</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			
			<!-- 此处为tomcat -->
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>tomcat-maven-plugin</artifactId>
				<configuration>
					<update>true</update>
					<url>http://localhost:8080/manager</url>
					<username>tomcat</username>
					<password>tomcat</password>
					<path>/portal</path>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>tomcat-maven-plugin</artifactId>
				<version>1.1</version>
				<configuration>
					<path>/portal</path>
					<port>8080</port>
					<uriEncoding>UTF-8</uriEncoding>
					<server>tomcat6</server>
				</configuration>
			</plugin>

			<!-- 此处为单独集成wildfly(jboss) -->
			<plugin>
				<groupId>org.wildfly.plugins</groupId>
				<artifactId>wildfly-maven-plugin</artifactId>
				<version>1.0.1.Final</version>
				<configuration>
					<username>wildfly</username>
					<password>wildfly</password>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>tomcat-maven-plugin</artifactId>
				<version>1.1</version>
				<configuration>
					<url>http://192.168.1.10:3080/manager/html</url>
					<username>tomcat</username>
					<password>deploy</password>
					<path>/portal</path>
				</configuration>
				<executions>
					<execution>
						<id>delpoy2test</id>
						<phase>deploy</phase>
						<goals>
							<goal>redeploy</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

	<dependencies>
		[...]
	</dependencies>
</project>


转载于:https://my.oschina.net/lgscofield/blog/265068

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值