Maven Glassfish插件 - 处理重新部署/部署/取消部署失败

时间:2015-01-29 07:13:59

标签: pom.xml maven-glassfish-plugin

我需要使用maven构建并将战争部署到glassfish中(问题如下所述)。

目前我设法使用maven glassfish插件部署战争,并且我使用了目标redploy,如下面的POM所示:



<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/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>Myapp</groupId>
	<artifactId>Myapp</artifactId>
	<packaging>war</packaging>
	<version>1.0</version>
	<name>APP WEB APP</name>
	<url>http://maven.apache.org</url>

	<build>
		<finalName>MyApp</finalName>
		<plugins>
			<plugin>
				<groupId>org.glassfish.maven.plugin</groupId>
				<artifactId>maven-glassfish-plugin</artifactId>
				<configuration>
					<terse>false</terse>
					<echo>true</echo>
					<debug>true</debug>
					<glassfishDirectory>C:\glassfish3\glassfish</glassfishDirectory>
					<user>admin</user>
					<adminPassword>admin</adminPassword>
					<domain>
						<name>domain1</name>
						<host>localhost</host>
						<adminPort>4848</adminPort>
					</domain>
					<components>
						<component>
							<name>${project.artifactId}</name>
							<artifact>${project.build.directory}/${project.build.finalName}.war</artifact>
						</component>
					</components>
				</configuration>
				<executions>
					<execution>
						<phase>install</phase>
						<goals>
							<goal>redeploy</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

</project>
&#13;
&#13;
&#13;

问题:说已经部署了战争,当我执行命令mvn clean install时,在部署过程中出现问题。因为我已经将目标用作重新部署战争第一次进行取消部署然后进行部署。在我的情况下,这个POM下次不能使用,因为失败并且战争不存在。

需要帮助 请帮助我在POM中检查战争是否已部署,然后根据我需要的结果来启动目标部署或取消部署哪些套件。

假设没有部署战争我需要调用glassfish:在POM中部署。

感谢您提前的时间

1 个答案:

答案 0 :(得分:1)

找到我的答案:

Redeploy remote glassfish with cargo fails

无论是否部署战争,货物插件都会解决上述问题。

Main Catch 正在添加

<cargo.runtime.args>force=true</cargo.runtime.args>