https://docs.spring.io/spring-boot/docs/current/maven-plugin/usage.html
I have a project, with 2 modules.
[Parent]
|-pom.xml
| [SpringBoot2App]
| |-pom.xml
| [test]
| |-pom.xml (start goal here!)
I want to run integration tests (maven failsafe plugin) in a separate project which is another module.
Is is possible to configure the spring boot maven plugin to start/stop the child module, during the integration tests of the parent module?
I tried something like this without success
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.SimpleServiceApplication</mainClass>
<classesDirectory>../SpringBoot2App/target/classes</classesDirectory>
<folders>
<param>../SpringBoot2App/target/test-classes</param>
</folders>
</configuration>
<executions>
<execution>
<goals>
<goal>start</goal>
</goals>
<phase>pre-integration-test</phase>
</execution>
</executions>
</plugin>
Which does not work.
I also tried to add a "project" parameter after reading the source of the super class of the plugin https://github.com/spring-projects/spring-boot/blob/master/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java
<configuration>
<mainClass>com.SimpleServiceApplication</mainClass>
<project>${project.parent.collectedProjects[0]}</project>
</configuration>
This refers to the right project, as debug shows, but does not work either.
Please don't comment on the [0], I know the [0] is not clean and is a coupling that requires direct knowledge of parent pom module ordering.
I get a java.lang.NoClassDefFoundError on org/springframework/boot/SpringApplication
I added the starter-web project to the test pom.xml, same result