1.添加插件
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>1.7.0</version>
<configuration>
<!--配置基本镜像-->
<from>
<image>openjdk:8-jdk-alpine</image>
</from>
<!--配置最终推送的地址,仓库名,镜像名-->
<to>
<image>registry.cn-beijing.aliyuncs.com/{命名空间}/{仓库名称}</image>
<tags>
<tag>1.0</tag>
</tags>
</to>
<!--私服是http不是https,默认jib不推送到非https的私服,私服添加,公服不添加-->
<!-- <allowInsecureRegistries>true</allowInsecureRegistries>-->
</configuration>
<!--绑定到maven lifecicle-->
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
2.执行构建,成功生成jar,并推送镜像到镜像仓库