Is it possible to use Spring Boots Maven plugin command spring-boot:run
when the parent POM of the project is using packaging mode POM because of its children?
I have multi module maven project with a "master" POM that is in it's turn a child of the Spring Boot Parent module. Looking something like this:
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>project</artifactId>
<packaging>pom</packaging>
<version>0.1.0</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.0.BUILD-SNAPSHOT</version>
<relativePath/>
</parent>
<modules>
<module>module1</module>
<module>module2</module>
<module>module3</module>
</modules>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<start-class>com.example.module1.Application</start-class>
<java.version>1.8</java.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
This is basically our "master" POM which every child uses as it's parent. Now we want to perform the spring-boot:run
command from the working directory this "master" POM is in. Problem is, this generates a ClassNotFoundException
which is odd since module1 (where this Application
class is located) is included in the POM and mentioned as a module.
Using a single module maven project and <packaging>jar</packaging>
this compiles and runs the Application class so it is not Spring-Boot that is not working right here.
What do I have to change to get this working or is it simply not possible to use the spring-boot-maven-plugin
plugin when dealing with multi module Maven projects?
Sidenote: My Application class / Module 1 has the other modules as dependencies so keep this in mind when answering the question. Any suggestions on how to improve this are very appreciated.