I am building my Java code into a jar file inside a Docker container:

[INFO] Building jar: /target/jartest.maven-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.101 s
[INFO] Finished at: 2019-04-15T16:43:32Z
[INFO] Final Memory: 14M/56M
[INFO] ------------------------------------------------------------------------

Based on the path above, I wanted to make that jar available to downloaded as a build artifact. Here is that definition in the .gitlab-ci.yml file:

    - target/jartest.maven-1.0-SNAPSHOT.jar

However, once the build is done, it says the file doesn't exist:

Uploading artifacts...
WARNING: target/jartest.maven-1.0-SNAPSHOT.jar: no matching files 
ERROR: No files to upload                          
Job succeeded

How do I accomplish my goal?

Additional notes:

This is the build stage in the .gitlab-ci.yml file:

  stage: build-master
    - docker build --pull -t "$CI_REGISTRY_IMAGE" .
    - docker push "$CI_REGISTRY_IMAGE"

And this is my Dockerfile:

FROM maven:3.5.2-jdk-8 as BUILD
COPY . .
RUN mvn -f pom.xml test
RUN mvn -f pom.xml package

0 Answers