2

我正在使用这样的 exec-maven-plugin 启动服务器:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>1.2.1</version>
    <executions>
        <execution>
            <id>start-server</id>
            <phase>pre-integration-test</phase>
            <goals>
                <goal>exec</goal>
            </goals>
            <configuration>
                <executable>java</executable>
                <arguments>
                    <argument>-classpath</argument>
                    <!-- automatically creates the classpath using all project dependencies, 
                        also adding the project build directory -->
                    <classpath />
                    <argument>MyGroup.MyServer.MyServerpjki</argument>
                    <argument>-batch</argument>
                    <argument>-port</argument>
                    <argument>1025</argument>
                </arguments>
            </configuration>
        </execution>
    </executions>
</plugin>

问题是在执行服务器进程后它会停在那里。似乎该进程正在阻止其他进程,尽管它在 exec-maven-plugin 页面上显示“exec:exec 在单独的进程中执行程序和 Java 程序”。

有什么我可以做的吗?我看到由 exec-maven-plugin 生成的进程阻止了 maven 进程,而Maven 和 Exec: forking a process? . 这个问题是否有独立于平台的解决方案?

我还有一个额外的问题:再次通过 exec-maven-plugin 关闭应用程序 startet 的最佳方法是什么?

4

0 回答 0