The problem is that we need to run the e2e tests (Cucumber) with some stubs and the Spring config server. Stubs and config server should start before the main application and should stop after the e2e tests.

With spring boot 2 (before removing the fork configuration) we were starting stubs and config server with the below configuration:

<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <configuration>
        <fork>false</fork>
        <profiles>
            <profile>local</profile>
        </profiles>
        <jmxName>org.springframework.boot:type=Admin,name=${project.artifactId}</jmxName>
    </configuration>
    <executions>
        <execution>
            <id>start-spring-boot-app</id>
            <phase>pre-integration-test</phase>
            <goals>
                <goal>start</goal>
            </goals>
        </execution>
    </executions>
</plugin>

and the maven-failsafe-plugin was ending the process.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
    <configuration>
        <testFailureIgnore>false</testFailureIgnore>
    </configuration>
    <executions>
        <execution>
            <id>integration-test</id>
            <goals>
                <goal>integration-test</goal>
                <goal>verify</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Also, I tried to kill the process with the shutdown of the maven-failsafe-plugin but it did not work. I have created a sample application on github.

I saw no replacement for fork on spring boot 3. So I need a solution for it and in my opinion, this is a typical setup to run e2e tests.

Comment From: wilkinsona

@J-mirzaei Have you looked at the stop goal? Am I right in thinking that it did not meet your needs because "stubs and config server should start before the main application and should stop after the e2e tests"? If so, https://github.com/bazaarvoice/maven-process-plugin may be of interest. It allows you to start as many processes as needed in the pre-integration-test phase, run your integration tests, and then stop the processes in the post-integration-test phase.

Comment From: J-mirzaei

Hi @wilkinsona Thank you for the fast response. It can be a solution and I will test it ASAP. It can be handier to have some solution on spring boot to run e2e tests.

Comment From: J-mirzaei

Hi @wilkinsona

It works. I did an update on the shared Github project. But as you see the plugin has open issues. For example, running commands on a Windows machine. There is also a workaround for that but not a nice solution. Thank you for the help.

Comment From: wilkinsona

Thanks for following up, @J-mirzaei. I think using the third-party plugin is the right approach. Unfortunately we don't have the resources to implement and maintain something similar, particularly as it isn't specific to Spring Boot and is more a general piece of Maven functionality. You may also want to consider using Gradle as it doesn't have the execution ordering problems that Maven's lifecycle- and phase-based approach does.

Comment From: ozozgun

I know the issue is closed, but in case someone else looking for a solution happens to be here, like me,
you can use the exec-maven-plugin 's goal exec:java to run any java application in the same JVM as maven.
Example of configuration:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>3.1.0</version>
    <executions>
        <execution>
            <id>java</id>
            <phase>compile</phase>
            <goals>
                <goal>java</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <mainClass>org.example.MySpringApp</mainClass>
    </configuration>
</plugin>