Can I use the Spring Boots Maven plugin spring-boot:run command when the parent POM of the project uses the POM package because of its children?
I have a project with several maven modules with a "master" POM, which in it turns the child of the module of the parent Spring module. Something like that:
<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 βmainβ POM, which every child uses as a parent. Now we want to execute the spring-boot:run command from the working directory where the "master" POM is located. The problem is that this throws a ClassNotFoundException , which is odd, since module1 (where this Application class is located) is included in the POM and is referred to as a module.
Using a single maven project module and <packaging>jar</packaging> , it compiles and runs the Application class, so Spring-Boot does not work.
What do I need to change to make this work, or is it just impossible to use the spring-boot-maven-plugin when working with multiple Maven modular projects?
Sidenote: my application class / module 1 has other modules as dependencies, so keep this in mind when answering the question. Any suggestions on how to improve this are greatly appreciated.
java spring spring-boot maven
Martijn
source share