采用SpringBoot分布式项目中我们往往会单独创建一个工具包如utils、core、commons、tools等非可执行项目,在项目部署进行Maven Install时会遇到问题,下面讲解Install非可执行项目中的问题
在父项目(POM)中需要添加如下代码
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>build-info</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<target>${java.version}</target>
<source>${java.version}</source>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
在可运行项目pom文件中需要添加如下代码
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
之后maven-update---->run-maven clean全部模块
总结
1、打jar之前一定要将全部模块执行一次maven clean之后进行maven install
2、maven打jar顺序一定先从非可执行模块到可执行模块依次进行Maven Install