4

这符合问题:Gracefully stop a java process started by maven-antrun-plugin

除了这涉及 maven-exec-plugin 我尝试了上面问题中提到的灵魂,它使“maven-process-plugin”成为 ude。但是这个插件不支持提供类路径。

我的 pom.xml 看起来像:

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

理想情况下,我应该在集成测试后阶段有一些机制来终止上面启动的进程(这是一个长时间运行的进程)?但我找不到任何可以帮助我做同样事情的配置:https: //www.mojohaus.org/exec-maven-plugin/exec-mojo.html

有出路吗?

4

0 回答 0