I have the following directory structure:
src
|
|___ main
|
|___ test
|
|___resources
I want to include all the files from test resources in the classpath when running the start goal (spring-boot:start, different than spring-boot:run) in phase pre-integration-test.
My pom.xml is:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
<execution>
<id>pre-integration-test</id>
<goals>
<goal>start</goal>
</goals>
<configuration>
<wait>1000</wait>
<maxAttempts>30</maxAttempts>
</configuration>
</execution>
<execution>
<id>post-integration-test</id>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
I tried without success including flags addResources or useTestClasspath, I really can't figure out how they are supposed to work even reading the documentation (https://docs.spring.io/spring-boot/docs/current/maven-plugin/start-mojo.html).
Thanks in advance.
Here is a working Maven configuration:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.2.2.RELEASE</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
<execution>
<id>pre-integration-test</id>
<goals>
<goal>start</goal>
</goals>
<configuration>
<classesDirectory>${project.build.testOutputDirectory}:${project.build.outputDirectory}</classesDirectory>
<wait>1000</wait>
<maxAttempts>30</maxAttempts>
</configuration>
</execution>
<execution>
<id>post-integration-test</id>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With