我尝试使用spotify / docker-maven-plugin失败,
下面是我pom.xml文件的一部分
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>${dockerfile-maven-version}</version>
<executions>
<execution>
<id>default</id>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
</executions>
<configuration>
<repository>myrepo/maven-docker-spotify</repository>
<tag>${project.version}</tag>
<buildArgs>
<JAR_FILE>${project.build.finalName}-jar-with-dependencies.jar</JAR_FILE>
</buildArgs>
</configuration>
</plugin>
答案 0 :(得分:0)
您使用的spotify/docker-maven-plugin当前处于无效状态。建议改用spotify/dockerfile-maven-plugin。
因此,将pom.xml文件的plugin部分更改为类似于
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>${dockerfile-maven-version}</version>
<executions>
<execution>
<id>default</id>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
</executions>
<configuration>
<repository>spotify/foobar</repository>
<tag>${project.version}</tag>
<buildArgs>
<JAR_FILE>${project.build.finalName}.jar</JAR_FILE>
</buildArgs>
</configuration>
</plugin>
注意:您也可以尝试使用JIB maven插件,该插件不需要安装docker并且可以在最低配置下工作。对于JIB,在命令中运行下面的命令足以完成任务
mvn compile com.google.cloud.tools:jib-maven-plugin:0.9.2:dockerBuild