<plugins>
<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <finalName>${project.name}</finalName> </configuration> </plugin> <!-- 打包时跳过test插件,不运行test测试用例 --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>${maven-surefire-plugin.version}</version> <configuration> <skipTests>true</skipTests> </configuration> </plugin><!-- docker的maven插件 -->
<plugin> <groupId>com.spotify</groupId> <artifactId>dockerfile-maven-plugin</artifactId> <version>${docker.maven.verion}</version> <executions> <!--执行 mvn package 时 自动构建docker镜像并推送到仓库 --> <execution> <id>default</id> <phase>package</phase> <goals> <goal>build</goal> <goal>push</goal> </goals> </execution> </executions> <configuration> <repository>${docker.registry}/${docker.namespace}/${project.artifactId}</repository> <tag>${project.version}</tag> <!-- 构建参数,指定jar包名称 --> <buildArgs> <JAR_FILE>${project.name}.jar</JAR_FILE> </buildArgs> </configuration> </plugin> </plugins> </build>