我正在尝试mvn clean package docker:build
在我的项目上执行它失败并出现以下错误
错误] 无法在项目 mma-access-management-auth-server 上执行目标 com.spotify:docker-maven-plugin:1.1.0:build (default-cli):捕获异常:复制失败:stat /var/lib/ docker/tmp/docker-builder181535370/mma-access-management-app-1.0.0-SNAPSHOT.jar:没有这样的文件或目录-> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException:无法执行目标com .spotify:docker-maven-plugin:1.1.0:build (default-cli) on project mma-access-management-auth-server:在 org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor. java:213) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146) at org.apache .maven.lifecycle.internal.LifecycleModuleBuilder。buildProject (LifecycleModuleBuilder.java:117) 在 org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) 在 org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder. java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309) at org.apache.maven.DefaultMaven .doExecute (DefaultMaven.java:194) 在 org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107) 在 org.apache.maven.cli.MavenCli.execute (MavenCli.java:955) 在 org.apache。 maven.cli.MavenCli.doMain (MavenCli.java:290) 在 org.apache.maven.cli.MavenCli.main (MavenCli.java:194) 在 sun.reflect.NativeMethodAccessorImpl。在 sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) 在 sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) 在 java.lang.reflect.Method.invoke (Method.java:43) 的 invoke0 (Native Method) 498) 在 org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289) 在 org.codehaus.plexus.Launcher.launch (Launcher.java:229) .classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356) 引起:org.apache.maven.plugin.MojoExecutionException:异常在 com.spotify.docker.BuildMojo.execute (BuildMojo.java:324) 在 org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208) 在 org.apache.maven.lifecycle 的 org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:134) .internal.MojoExecutor.execute (MojoExecutor.java:154) 在 org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146) 在 org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder .java:117) 在 org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) 在 org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51 ) 在 org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) 在 org.org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194) 在 org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309) 在 org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107) 在 org .apache.maven.cli.MavenCli.execute (MavenCli.java:955) 在 org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290) 在 org.apache.maven.cli.MavenCli.main (MavenCli .java:194) 在 sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) 在 sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) 在 sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) 在 java。 org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289) 在 org.codehaus.plexus.classworlds.launcher 的 lang.reflect.Method.invoke (Method.java:498)。Launcher.launch (Launcher.java:229) 在 org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415) 在 org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java: 356)引起:com.spotify.docker.client.exceptions.DockerException:复制失败:stat /var/lib/docker/tmp/docker-builder181535370/mma-access-management-app-1.0.0-SNAPSHOT.jar:没有这样的文件或目录
这是我的 pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.mma</groupId>
<artifactId>mma-access-management-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>mma-access-management-auth-server</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>mma-access-management-rest-api</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.5.8.RELEASE</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>1.1.0</version>
<configuration>
<imageName>mma/${project.artifactId}</imageName>
<imageTags>
<imageTag>${project.version}</imageTag>
<imageTag>latest</imageTag>
</imageTags>
<dockerDirectory>dockerfile</dockerDirectory>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
</configuration>
</plugin>
</plugins>
</build>
这是我的 Dockerfile
FROM openjdk:8u131-jdk-alpine
ENV targetDir /usr/local/access-management-app-1.0.0-SNAPSHOT.jar
ENV srcDir .
ENV jarFile mma-access-management-app-1.0.0-SNAPSHOT.jar
RUN mkdir ${targetDir}
COPY ${srcDir}/${jarFile} ${targetDir}
WORKDIR ${targetDir}
CMD ["java", "-jar", "mma-access-management-app-1.0.0-SNAPSHOT.jar"]
EXPOSE 8080/tcp
我不知道那会出错。我还尝试使用来自 spotify 的 dockerfile 插件,但也失败了。