I need to run a SpringBootApplication which is in test package during my integration test with spring-boot-maven-plugin (start and stop goals)
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>launchers.ApplicationTestMode</mainClass>
</configuration>
</plugin>
but I get with no surprise a ClassNotFoundException
How to run this SpringBootApplication in test package ?
I was able to get this running with:
You have to add the
test-classes. I assume you are using the SpringBootApplication from your main code. So add the originalclassesas well. If you use some test dependencies(e.g. testcontainers) in youlaunchers.ApplicationTestMode, then add<useTestClasspath>true</useTestClasspath>