简体   繁体   English

无法在 spring-boot-maven-plugin 中分叉

[英]Unable to fork in spring-boot-maven-plugin

I am trying to bring up a spring boot application in pre-integration-phase and run some integration tests against it.我正在尝试在集成前阶段启动一个 spring boot 应用程序,并对它运行一些集成测试。

Below is the configuration, in fork mode false, i can verify that the application is coming up but even after turning fork true either by command line or via configuration the application is not coming up in fork jvm but in the same jvm.下面是配置,在 fork 模式 false 下,我可以验证应用程序是否正在运行,但即使通过命令行或通过配置将 fork 设置为 true 之后,应用程序也不会在 fork jvm 中出现,而是在同一个 jvm 中出现。

<plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>2.1.1.RELEASE</version>
                <configuration>
                    <mainClass>com.settlement.Settlement</mainClass>
                    <layout>ZIP</layout>
                    <jvmArguments>
                        -DconfigDbPropertiesFile=../../common/profile/src/main/resources/${user.name}.properties -Dsettlement.rest.port=9090 -DcomponentPort=1779
                    </jvmArguments>
                    <fork>true</fork>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>start-service</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>start</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>stop-service</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>stop</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

command to execute要执行的命令

mvn spring-boot:run -Dspring-boot.run.arguments=Settlement,Settlement,Settlement,BASE_PERSISTENCE_CONSTANTS -Dspring-boot.run.fork=true

This maven code works for me这个 Maven 代码对我有用

<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <configuration>
        <fork>true</fork>
    </configuration>
    <executions>
        <execution>
            <configuration>
                <mainClass>com.ashomokdev.springdockerec2.SpringDockerEc2Application</mainClass>
            </configuration>
        </execution>
    </executions>
</plugin>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM