Process execution maven plugin

Sonatype helps open source projects to set up Maven repositories on https://oss.sonatype.org/

Categories

Categories

Maven Build Tools
GroupId

GroupId

com.bazaarvoice.maven.plugins
ArtifactId

ArtifactId

process-exec-maven-plugin
Last Version

Last Version

0.9
Release Date

Release Date

Type

Type

maven-plugin
Description

Description

Process execution maven plugin
Sonatype helps open source projects to set up Maven repositories on https://oss.sonatype.org/
Source Code Management

Source Code Management

https://github.com/bazaarvoice/maven-process-plugin

Download process-exec-maven-plugin

How to add to project

<plugin>
    <groupId>com.bazaarvoice.maven.plugins</groupId>
    <artifactId>process-exec-maven-plugin</artifactId>
    <version>0.9</version>
</plugin>

Dependencies

compile (6)

Group / Artifact Type Version
com.google.guava : guava jar 15.0
org.apache.maven.plugin-tools : maven-plugin-annotations jar 3.0
org.apache.maven : maven-plugin-api jar 3.0
org.apache.maven : maven-core jar 3.0
org.apache.commons : commons-exec jar 1.2
commons-io : commons-io jar 2.1

test (2)

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

Project Modules

There are no modules declared in this project.

Build Status

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</argument>
        <argument>-jar</argument>
        <argument>drop-wizard-app.jar</argument>
        <argument>server</argument>
        <argument>config.yaml</argument>
    </arguments>
    
  • 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.

  • 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.

NOTE: As of 0.7, killing the maven process (using Ctrl+C or kill command) will stop all the processes started by the plugin.

POM example:

The latest version is 0.7.

<build>
    <plugins>
        <plugin>
            <groupId>com.bazaarvoice.maven.plugins</groupId>
            <artifactId>process-exec-maven-plugin</artifactId>
            <version>0.7</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</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</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>
com.bazaarvoice.maven.plugins

Bazaarvoice

Versions

Version
0.9
0.8
0.7
0.5
0.4