Gracefully stop a java program started by maven-exec plugin

1k Views Asked by At

This is in line with the question: Gracefully stopping a java process started by maven-antrun-plugin

Except that this concerns the maven-exec-plugin I tried the soultion mentioned in the question above, which makes ude of the "maven-process-plugin". But this plugin doesn't have support to supply a classpath.

My pom.xml looks like:

<project>
    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.6.0</version>
                <execution>
                    <id>start the server for integration tests</id>
                    <phase>pre-integration-test</phase>
                    <goals>
                        <goal>exec</goal>
                    </goals>
                    <configuration>
                        <classpathScope>test</classpathScope>
                        <async>true</async>
                        <asyncDestroyOnShutdown>true</asyncDestroyOnShutdown>
                        <executable>java</executable>
                        <arguments>
                            <argument>-classpath</argument>
                            <classpath/>
                            <argument>com.abc.def.integration.Main</argument>
                        </arguments>
                    </configuration>
                </execution>
                <execution>
                    <phase>post-integration-test</phase>
                    <goals/>
                </execution>
            </plugin>
        </plugins>
    </build>
</project>

Ideally I should be having some mechanism in the post-integration-test phase to kill the process started above (It is a long running process)? But I couldn't find any config that will help me do the same at: https://www.mojohaus.org/exec-maven-plugin/exec-mojo.html

Is there a way out?

0

There are 0 best solutions below