Reputation: 1416
Ok, I will just get right into it. I have a multi module maven project using spring. The project structure can be summarized as such:
Project Root
|--common module
|----src
|----pom.xml
|--module 1
|----src
|----pom.xml
|--module 2
|----src
|----pom.xml
|-pom.xml
In this case, I have the root level pom file declaring spring-boot-starter as a parent:
<groupId>com.example.stackoverflow</groupId>
<artifactId>indania-jones</artifactId>
<version>VersionNumber</version>
<packaging>pom</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.2.RELEASE</version>
</parent>
The sub-modules have the root pom as their parent.
<parent>
<groupId>com.example.stackoverflow</groupId>
<artifactId>indiana-jones</artifactId>
<version>VersionNumber</version>
</parent>
<artifactId>module-1</artifactId>
In this simplified case, module 1 and module 2 also have common module as a dependency. When trying to run locally, I use mvn install on the common module so that I can run the other two modules. The problem is, that when I run mvn install on common it fails.
[ERROR] Failed to execute goal org.springframework.boot:spring-boot- maven-plugin:1.3.2.RELEASE:repackage (default) on project q-common: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.3.2.RELEASE:repackage failed: Unable to find main class -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
It appears as though the spring-boot-starter-parent's pom is performing extra duties of which I do not want to perform.
In case you need the why and what, the modules are specific REST services and the common module contains shared DTO's and persistence objects common to both of them. As I see it, I have a few options:
I can separate out the dependencies so module 1 and module 2 have spring-boot-starter-parent as their parent and remove spring-boot-starter from the root pom, thereby freeing common.
I can remove the root pom as the parent to common.
I can manually build out everything the spring-boot-starter does in the project.
Which one of these options is the best, or is there an option I am not seeing that is preferable?
Upvotes: 1
Views: 2797
Reputation: 2265
Spring-boot has maven build plugin. If it is included in you pom. remove it and try.
Upvotes: 1