三步曲
SmallArea
-- distributed-smallarea-common
-- distributed-smallarea-service
-- user-service (需要打包插件)
-- store-service(需要打包插件)
不管是什么模块,打包前:
1、保证良好的关系下,父模块、公共都不需要打包插件,只有能启动的具体模块才需要加插件,即:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions> <!--没有它,springboot打包出来的jar运行报错-->
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.3.6</version>
<configuration>
<repository>${project.artifactId}</repository>
<buildArgs>
<JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE>
</buildArgs>
</configuration>
</plugin>
</plugins>
</build>
2、然后对要打包的模块的父模块进行安装(有几个父模块就打几个):切换到父模块根目录下执行: mvn clean install 或 mvn -f 指定的位置 clean install
3、对公共模块进行安装 ,安装方法根父模块安装方法一样