Process execution maven plugin

Start multiple processes in pre-integration-test phase and stop same processes in post-integration-test phase

License

License

Categories

Categories

Maven Build Tools
GroupId

GroupId

org.honton.chas
ArtifactId

ArtifactId

process-exec-maven-plugin
Last Version

Last Version

0.9.2
Release Date

Release Date

Type

Type

maven-plugin
Description

Description

Process execution maven plugin
Start multiple processes in pre-integration-test phase and stop same processes in post-integration-test phase
Project URL

Project URL

https://github.com/chonton/process-exec-maven-plugin
Source Code Management

Source Code Management

https://github.com/chonton/process-exec-maven-plugin

Download process-exec-maven-plugin

How to add to project

<plugin>
    <groupId>org.honton.chas</groupId>
    <artifactId>process-exec-maven-plugin</artifactId>
    <version>0.9.2</version>
</plugin>

Dependencies

compile (6)

Group / Artifact Type Version
commons-net : commons-net jar 3.5
org.apache.maven : maven-core jar 3.0
org.apache.maven : maven-model jar 3.0
org.apache.maven : maven-plugin-api jar 3.0
org.apache.maven.plugin-tools : maven-plugin-annotations jar 3.0
org.honton.chas.url : url-extension jar 0.0.1

test (2)

Group / Artifact Type Version
junit : junit jar 4.12
org.apache.maven.plugin-testing : maven-plugin-testing-harness jar 2.1

Project Modules

There are no modules declared in this project.

process-exec-maven-plugin

Improve end-to-end integration testing with maven. Process Executor Plugin allows you to to start multiple processes in pre-integration-test phase in order, and then stops all the processes in post-integration-test phase, in reverse order.

Goals

  • start - Pre-Integration-test phase. Starts a given process in the pre-integration-test phase. Requires one execution per process.
  • stop-all - Post-Integration-test phase. Stops all processes that are started in the pre-integration-test phase, in reverse order. Requires only one execution for all processes.

Arguments

  • arguments: Command line arguments as you would provide when starting a process in your terminal. So, for example to run something like this
   java -jar drop-wizard-app.jar server config.yaml

set arguments as:

  <arguments>
    <argument>${java.home}/bin/java</argument>
    <argument>-jar</argument>
    <argument>drop-wizard-app.jar</argument>
    <argument>server</argument>
    <argument>config.yaml</argument>
  </arguments>
  • environment: Environment variables for the process
  <environment>
    <TERM>vt100</TERM>
  </environment>
  • name: Give a name to the process to start.
  • workingDir: Give a working directory for your process to start in. Could be same as name. If not provided, the build directory is used.
  • waitForInterrupt: Optional. Setting this value to true will pause your build after starting every process to give you a chance to manually play with your system. Default is false.
  • healthCheckUrl: Recommended, but optional. You should provide a healthcheck url, so the plugin waits until the healthchecks are all green for your process. If not provided, the plugin waits for waitAfterLaunch seconds before moving on.
  • healthCheckValidateSsl: Optional. If healthCheckUrl is specified, and is an HTTPS URL, Java's default SSL TrustManager will be used by default. If you are using a self-signed certificate, this parameter can be set to false to use a TrustManager that doesn't validate the certification path.
  • waitAfterLaunch: Optional. This specifies the maximum time in seconds to wait after launching the process. If healthCheckUrl is specified, then it will move on as soon as the health checks pass. Default is 30 seconds.
  • processLogFile: Optional. Specifying a log file will redirect the process output to the specified file. Recommended as this will avoid cluttering your build's log with the log of external proccesses.

Killing processes on exit

Killing the maven process (using Ctrl+C or kill <pid> command) will stop all the processes started by the plugin.

HealthCheckUrl

The health check url can be any scheme natively supported by JRE, or 'tcp'. Additional url schemes can be supported as described in url-extension

POM example:

<build>
  <plugins>
    <plugin>
      <groupId>org.honton.chas</groupId>
      <artifactId>process-exec-maven-plugin</artifactId>
      <version>0.9.2</version>
      <executions>
        <!--Start process 1, eg., a dropwizard app dependency-->
        <execution>
          <id>switchboard-process</id>
          <phase>pre-integration-test</phase>
          <goals>
            <goal>start</goal>
          </goals>
          <configuration>
            <name>Switchboard2</name>
            <workingDir>switchboard2</workingDir>
            <waitForInterrupt>false</waitForInterrupt>
            <healthCheckUrl>http://localhost:8381/healthcheck</healthCheckUrl>
            <arguments>
              <argument>${java.home}/bin/java</argument>
              <argument>-jar</argument>
              <argument>${basedir}/../../app/target/switchboard-${project.version}.jar</argument>
              <argument>server</argument>
              <argument>${basedir}/bin/switchboard.yaml</argument>
            </arguments>
          </configuration>
        </execution>
        <!--Start process 2, eg., another dropwizard app dependency-->
        <execution>
          <id>emodb-shovel-process</id>
          <phase>pre-integration-test</phase>
          <goals>
            <goal>start</goal>
          </goals>
          <configuration>
            <name>emodb-shovel</name>
            <workingDir>shovel</workingDir>
            <waitForInterrupt>false</waitForInterrupt>
            <healthCheckUrl>http://localhost:8181/healthcheck</healthCheckUrl>
            <arguments>
              <argument>${java.home}/bin/java</argument>
              <argument>-jar</argument>
              <argument>${basedir}/../../app/target/emodb-shovel-app-${project.version}.jar</argument>
              <argument>server</argument>
              <argument>${basedir}/bin/config-local-dc.yaml</argument>
            </arguments>
          </configuration>
        </execution>
        <!--Stop all processes in reverse order-->
        <execution>
          <id>stop-all</id>
          <phase>post-integration-test</phase>
          <goals>
            <goal>stop-all</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

Versions

Version
0.9.2
0.9.1
0.9