[ERROR] Failed to execute goal io.fabric8:docker-maven-plugin:0.22.1:build (default-cli) on project auth-server: Unable to parse configuration of mojo io.fabric8:docker-maven-plugin:0.22.1:build for parameter buildArgs: Cannot find 'buildArgs' in class io.fabric8.maven.docker.config.BuildImageConfiguration -> [Help 1]
下面是我的构建配置
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.22.1</version>
<configuration>
<machine>
<name>default</name>
<autoCreate>true</autoCreate>
<createOptions>
<driver>virtualbox</driver>
<virtualbox-cpu-count>2</virtualbox-cpu-count>
</createOptions>
</machine>
<verbose>true</verbose>
<images>
<image>
<name>${docker.image.prefix}/${project.artifactId}</name>
<build>
<buildArgs>
<finalName>${project.build.finalName}.jar</finalName>
</buildArgs>
<dockerFile>Dockerfile</dockerFile>
<assembly>
<descriptorRef>artifact</descriptorRef>
</assembly>
</build>
</image>
</images>
</configuration>
</plugin>
更新2:
Unable to parse configuration of mojo io.fabric8:docker-maven-plugin:0.22.1:build for parameter docker.buildArg.myFinalName: Cannot find 'docker.buildArg.myFinalName' in class io.fabric8.maven.docker.config.BuildImageConfiguration -> [Help 1]
新配置
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.22.1</version>
<configuration>
<machine>
<name>default</name>
<autoCreate>true</autoCreate>
<createOptions>
<driver>virtualbox</driver>
<virtualbox-cpu-count>2</virtualbox-cpu-count>
</createOptions>
</machine>
<verbose>true</verbose>
<images>
<image>
<name>${docker.image.prefix}:${project.artifactId}</name>
<build>
<docker.buildArg.myFinalName>${project.build.finalName}.${artifact.extension}</docker.buildArg.myFinalName>
<dockerFile>Dockerfile</dockerFile>
<assembly>
<descriptorRef>artifact</descriptorRef>
</assembly>
</build>
</image>
</images>
</configuration>
</plugin>
答案 0 :(得分:0)
以下工作
<images>
<image>
<name>${docker.image.prefix}/${project.artifactId}</name>
<build>
<dockerFile>Dockerfile</dockerFile>
<assembly>
<descriptorRef>artifact</descriptorRef>
</assembly>
<args>
<FINAL_NAME>${project.build.finalName}.${project.packaging}</FINAL_NAME>
</args>
</build>
</image>
</images>
答案 1 :(得分:0)
以下为我工作
<images>
<image>
<name>${docker.image.prefix}/${docker.image.name}</name>
<build>
<dockerFileDir>${project.basedir}/src/main/docker/</dockerFileDir>
<!--copies artifact to docker build dir in target-->
<assembly>
<descriptorRef>artifact</descriptorRef>
</assembly>
<args>
<IMAGE_VERSION>${build.version}</IMAGE_VERSION>
</args>
<tags>
<tag>latest</tag>
<tag>${project.version}</tag>
</tags>
</build>
</image>
</images>
FROM ...
ARG IMAGE_VERSION
VOLUME /tmp
ADD maven/spring-boot-docker-${IMAGE_VERSION}.jar myapp.jar
....