spotify / docker-maven-plugin

INACTIVE: A maven plugin for Docker
Apache License 2.0
2.67k stars 575 forks source link

No such file exception while running plugin on windows #407

Closed abhayJava closed 5 years ago

abhayJava commented 6 years ago

Description

How to reproduce

pom is as follows:-

 <plugin>
    <groupId>com.spotify</groupId>
    <artifactId>docker-maven-plugin</artifactId>
     <version>1.2.0</version>
     <configuration>
      <imageName>abhayjava/${project.artifactId}</imageName>
           <dockerDirectory>${project.basedir}/docker</dockerDirectory>
    <resources>
          <!-- copy the service's jar file from target into the root directory of the image -->
          <resource>
            <targetPath>/</targetPath>
            <directory>${project.build.directory}</directory>
            <include>${project.build.finalName}.jar</include>
          </resource>
                      </resources>
    </configuration>

  </plugin>

folder structure of maven project is spring-boot-poc src docker(this contains docker file) target

docker file FROM openjdk ADD /target/springboot-poc-0.0.1-SNAPSHOT.jar springboot-poc.jar EXPOSE 8080 ENTRYPOINT ["java","-jar","springboot-poc.jar"]

What do you expect

Should have built the image succefully

What happened instead

* Exception***

 Failed to execute goal com.spotify:docker-maven-plugin:1.1.1:build (default-cli) on project springboot-poc: Exception caught: ADD failed: stat /var/lib/docker/tmp/docker-builder832221197/target/springboot-poc-0.0.1-SNAPSHOT.jar: no such file or directory -
## Software:

- docker version: 18.06.0-ce
- docker-maven-plugin version: 1.2.0

## Full backtrace
D:\nova\springboot-poc>mvn clean package docker:build
[INFO] Scanning for projects...
Downloading from spring-snapshots: https://repo.spring.io/snapshot/com/spotify/docker-maven-plugin/1.2.0/docker-maven-plugin-1.2.0.pom
Downloading from spring-milestones: https://repo.spring.io/milestone/com/spotify/docker-maven-plugin/1.2.0/docker-maven-plugin-1.2.0.pom
Downloading from central: https://repo.maven.apache.org/maven2/com/spotify/docker-maven-plugin/1.2.0/docker-maven-plugin-1.2.0.pom
Downloaded from central: https://repo.maven.apache.org/maven2/com/spotify/docker-maven-plugin/1.2.0/docker-maven-plugin-1.2.0.pom (13 kB at 4.9 kB/s)
Downloading from spring-snapshots: https://repo.spring.io/snapshot/com/spotify/docker-maven-plugin/1.2.0/docker-maven-plugin-1.2.0.jar
Downloading from spring-milestones: https://repo.spring.io/milestone/com/spotify/docker-maven-plugin/1.2.0/docker-maven-plugin-1.2.0.jar
Downloading from central: https://repo.maven.apache.org/maven2/com/spotify/docker-maven-plugin/1.2.0/docker-maven-plugin-1.2.0.jar
Downloaded from central: https://repo.maven.apache.org/maven2/com/spotify/docker-maven-plugin/1.2.0/docker-maven-plugin-1.2.0.jar (53 kB at 26 kB/s)
[INFO]
[INFO] ---------------------< com.ak.poc:springboot-poc >----------------------
[INFO] Building springboot-poc 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) @ springboot-poc ---
[INFO] Deleting D:\nova\springboot-poc\target
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ springboot-poc ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ springboot-poc ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 3 source files to D:\nova\springboot-poc\target\classes
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ springboot-poc ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\nova\springboot-poc\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) @ springboot-poc ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to D:\nova\springboot-poc\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.21.0:test (default-test) @ springboot-poc ---
[INFO]
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.ak.poc.spring_kafka.AppTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.053 s - in com.ak.poc.spring_kafka.AppTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- maven-jar-plugin:3.0.2:jar (default-jar) @ springboot-poc ---
[INFO] Building jar: D:\nova\springboot-poc\target\springboot-poc-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] --- spring-boot-maven-plugin:2.0.6.RELEASE:repackage (default) @ springboot-poc ---
[INFO]
[INFO] --- docker-maven-plugin:1.2.0:build (default-cli) @ springboot-poc ---
Downloading from spring-snapshots: https://repo.spring.io/snapshot/com/spotify/docker-client/8.14.1/docker-client-8.14.1.pom
Downloading from spring-milestones: https://repo.spring.io/milestone/com/spotify/docker-client/8.14.1/docker-client-8.14.1.pom
Downloading from central: https://repo.maven.apache.org/maven2/com/spotify/docker-client/8.14.1/docker-client-8.14.1.pom
Downloaded from central: https://repo.maven.apache.org/maven2/com/spotify/docker-client/8.14.1/docker-client-8.14.1.pom (14 kB at 15 kB/s)
Downloading from spring-snapshots: https://repo.spring.io/snapshot/com/spotify/docker-client/8.14.1/docker-client-8.14.1-shaded.jar
Downloading from spring-milestones: https://repo.spring.io/milestone/com/spotify/docker-client/8.14.1/docker-client-8.14.1-shaded.jar
Downloading from central: https://repo.maven.apache.org/maven2/com/spotify/docker-client/8.14.1/docker-client-8.14.1-shaded.jar
Downloaded from central: https://repo.maven.apache.org/maven2/com/spotify/docker-client/8.14.1/docker-client-8.14.1-shaded.jar (12 MB at 582 kB/s)
[INFO] Using authentication suppliers: [ConfigFileRegistryAuthSupplier]
[INFO] Copying D:\nova\springboot-poc\target\springboot-poc-0.0.1-SNAPSHOT.jar -> D:\nova\springboot-poc\target\docker\springboot-poc-0.0.1-SNAPSHOT.jar
[INFO] Copying D:\nova\springboot-poc\docker\Dockerfile -> D:\nova\springboot-poc\target\docker\Dockerfile
[INFO] Building image abhayjava/springboot-poc
Step 1/4 : FROM openjdk

 ---> 4697b3a5fe9a
Step 2/4 : ADD /target/springboot-poc-0.0.1-SNAPSHOT.jar springboot-poc.jar

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 43.457 s
[INFO] Finished at: 2018-10-28T17:46:42+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:1.2.0:build (default-cli) on project springboot-poc: Exception caught: ADD failed: stat /var/lib/docker/tmp/docker-builder267404231/target/springboot-poc-0.0.1-SNAPSHOT.jar: no such file or directory -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.