Skip to content

Instantly share code, notes, and snippets.

@michaelajr
Created May 26, 2018 15:57
Show Gist options
  • Save michaelajr/594bc09862e65577de0df308f1bdccce to your computer and use it in GitHub Desktop.
Save michaelajr/594bc09862e65577de0df308f1bdccce to your computer and use it in GitHub Desktop.
Maven For Pipelining, Part 1
<!-- Run integration tests against Tomcat with code coverage -->
<profile>
<id>integration-test</id>
<activation>
<file>
<exists>${basedir}/src/test</exists>
</file>
</activation>
<properties>
<itServerHome>${project.build.directory}/${itServerId}</itServerHome>
</properties>
<build>
<pluginManagement>
<plugins>
<!-- Code coverage -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<!-- Before running integration tests -->
<execution>
<id>preIT</id>
<phase>pre-integration-test</phase>
<goals>
<goal>prepare-agent-integration</goal>
</goals>
<configuration>
<skip>${skipIntegrationTests}</skip>
<destFile>${project.build.directory}/jacoco-it.exec</destFile>
<propertyName>argLine</propertyName>
</configuration>
</execution>
<!-- After integration tests -->
<execution>
<id>postIT</id>
<phase>post-integration-test</phase>
<goals>
<goal>dump</goal>
<goal>report-integration</goal>
</goals>
<configuration>
<skip>${skipIntegrationTests}</skip>
<port>${itServerDumpPort}</port>
<destFile>${project.build.directory}/jacoco-it.exec</destFile>
</configuration>
</execution>
</executions>
</plugin>
<!-- Tomcat -->
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.6.2</version>
<configuration>
<container>
<containerId>${itServerId}</containerId>
<output>${itServerHome}/logs/catalina.out</output>
</container>
<configuration>
<type>standalone</type>
<home>${itServerHome}</home>
<properties>
<cargo.servlet.port>${itServerPort}</cargo.servlet.port>
<cargo.tomcat.ajp.port>${itServerAjpPort}</cargo.tomcat.ajp.port>
<cargo.rmi.port>${itServerRmiPort}</cargo.rmi.port>
<cargo.start.jvmargs>
${argLine},output=tcpserver,port=${itServerDumpPort}
${appJvmArgs} ${jvmArgs}
</cargo.start.jvmargs>
</properties>
</configuration>
<deployables>
<deployable>
<properties>
<context>${itServerContext}</context>
</properties>
</deployable>
</deployables>
</configuration>
<executions>
<!-- Before integration tests -->
<execution>
<id>preIT</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
<configuration>
<skip>${skipIntegrationTests}</skip>
</configuration>
</execution>
<!-- After integration tests -->
<execution>
<id>postIT</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
<configuration>
<skip>${skipIntegrationTests}</skip>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<!-- Use in lifecycle -->
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment