Maven reactor: pom using Spring bootstrap pom starter

I have a project with multiple modules. Some of them are using spring boot, others are simple jars without any spring dependency. So I have a parent pom.xml setup with each module. Spring boot projects problems.

I have installed spring boot dependencies scope=import

as mentioned here in every spring boot project. It's right? Or should I move it to the parent POM?

Problems I am facing 1. When I run the mvn package from the top folder, it does not repackage spring boot jars. 2. My spring boot projects have listed other spring boot dependencies. with spring boot starter as parent, they don't need version tag. Now they do it. I defined this as a property in my parent pom and added a version tag, but want to know if it's better.

Thanks for reading.

Update answer to comment # 1: I have spring-boot-maven-plugin

in parent POM like below

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <version>1.1.9.RELEASE</version>
        </plugin>
    </plugins>
    <pluginManagement>
 ....
 </build>

      

I also tried to run mvn spring-boot:repackage

manually in my spring boot project but these are errors with:repackage failed: Source must refer to an existing file -> [Help 1]

+3


source to share


1 answer


If you do not inherit from the spring boot parent, you must declare spring-boot-maven-plugin in the plugins section of your pom for repackaging to occur.

You need to add the following to the plugin:

 <executions>
     <execution>
         <goals>
             <goal>repackage</goal>
         </goals>
     </execution>
  </executions>

      



You have to put the plugin under pluginManagement in the parent pom and add

<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-mavenβ€Œβ€‹-plugin</artifactId>
</plugin> 

      

in each build section for each module that relies on spring boot.

+6


source







All Articles