Maven reactor:使用Spring boot starter pom的pom

Rag*_*ghu 3 spring maven maven-reactor spring-boot

我有一个包含多个模块的项目.其中一些使用弹簧靴,另一些是没有任何弹簧依赖的普通罐.所以我为每个模块设置了父pom.xml.问题在于春季启动项目.

我设置的弹簧引导依赖关系scope=import所列这里 在每年春季启动项目.它是否正确?或者我应该将它移动到我的父POM中?

我遇到的问题1.当我从顶层文件夹运行mvn包时,它不会重新打包spring boot jar.我的春季启动项目列出了其他春季启动依赖项.使用spring boot starter作为父级,他们不需要版本标记.现在他们做了.我已将其定义为我父pom中的属性并添加了版本标签,但想知道这是否更好.

谢谢阅读.

更新对评论#1的回复:我spring-boot-maven-plugin在我的父POM中有以下内容

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <version>1.1.9.RELEASE</version>
        </plugin>
    </plugins>
    <pluginManagement>
 ....
 </build>
Run Code Online (Sandbox Code Playgroud)

我也试过mvn spring-boot:repackage在我的春季启动项目中手动运行- 但是错误的出现了:repackage failed: Source must refer to an existing file -> [Help 1]

Ori*_*Dar 6

如果你不从spring boot parent继承,你必须在你的pom的plugins部分声明spring-boot-maven-plugin才能重新打包.

您必须将以下内容添加到插件中:

 <executions>
     <execution>
         <goals>
             <goal>repackage</goal>
         </goals>
     </execution>
  </executions>
Run Code Online (Sandbox Code Playgroud)

您应该将插件放在父pom中的pluginManagement下,然后添加

<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven??-plugin</artifactId>
</plugin> 
Run Code Online (Sandbox Code Playgroud)

在每个构建部分下,每个模块依赖于弹簧引导.