我正在编写一个充当 Jenkins CI webapp 客户端的 JAR 文件。所以我的项目有jar包,没有war包。但是,对于集成测试,我需要部署 Jenkins WAR 来测试我的 JAR 类。
我正在使用 cargo-maven2-plugin,并对其进行设置,以便我可以使用“mvn cargo:run”从命令行启动 Jenkins 但是,运行“mvn install”进入集成测试阶段而不尝试启动詹金斯与货物。事实上,“mvn install -X”的输出甚至没有提到“cargo”这个词。
看起来我已经正确地将货物绑定到预集成测试和集成后测试,但它不会触发。
下面的POM:
<?xml version="1.0" encoding="UTF-8"?>
<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>4.0.0</modelVersion>
<groupId>com.phoenix.build</groupId>
<artifactId>HostOp</artifactId>
<packaging>jar</packaging>
<version>0.0.1-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jetty.port>53657</jetty.port><!-- mnemonic: 'JENKS' on a telephone -->
</properties>
<name>Host Operations</name>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.7.2</version>
<configuration>
<systemProperties>
<property>
<name>maven.output.dir</name>
<value>${project.build.directory}</value>
</property>
</systemProperties>
<excludes>
<exclude>**/*IntegrationTest.java</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>integration-tests</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<skip>false</skip>
<excludes>
<exclude>none</exclude>
</excludes>
<includes>
<include>**/*IntegrationTest.java</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<executions>
<execution>
<id>start-container</id>
<phase>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>
<configuration>
<container>
<containerId>jetty6x</containerId>
<type>embedded</type>
<systemProperties>
<JENKINS_HOME>target/test-classes/jenkins_home</JENKINS_HOME>
</systemProperties>
</container>
<configuration>
<properties>
<cargo.servlet.port>53657</cargo.servlet.port>
<cargo.jvmargs>-DJENKINS_HOME=target/test-classes/jenkins_home</cargo.jvmargs>
</properties>
<deployables>
<deployable>
<type>war</type>
<location>target/test-classes/jenkins.war</location>
<pingURL>http://localhost:53657/jenkins/view/All/newJob</pingURL>
</deployable>
</deployables>
</configuration>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
</dependency>
</dependencies>
</project>
我怎样才能让它根据需要开火?