簡體   English   中英

GitLab CI/CD Maven SpringBoot上傳*jar錯誤:沒有這樣的文件或目錄

[英]GitLab CI/CD Maven SpringBoot upload *jar error: No such file or directory

我正在嘗試設置 Springboot monorepo GitLab 管道,但找不到工件。

mvn 工作

maven-package:
  stage: package
  inherit:
    default: true
    variables: true
  script:
    - cd springboot
    - mvn clean package -P dev
    - cd target
    - ls -al
  artifacts:
    when: always
    paths:
      - springboot.jar
  tags:
    - docker

作業日志

$ cd target
$ ls -al
total 41124
drwxr-xr-x 9 root root     4096 Jun 25 11:53 .
drwxrwxrwx 5 root root     4096 Jun 25 11:53 ..
drwxr-xr-x 4 root root     4096 Jun 25 11:53 classes
drwxr-xr-x 3 root root     4096 Jun 25 11:53 generated-sources
drwxr-xr-x 3 root root     4096 Jun 25 11:53 generated-test-sources
drwxr-xr-x 2 root root     4096 Jun 25 11:53 maven-archiver
drwxr-xr-x 3 root root     4096 Jun 25 11:53 maven-status
-rw-r--r-- 1 root root 42053990 Jun 25 11:53 springboot.jar
-rw-r--r-- 1 root root    13258 Jun 25 11:53 springboot.jar.original
drwxr-xr-x 2 root root     4096 Jun 25 11:53 surefire-reports
drwxr-xr-x 3 root root     4096 Jun 25 11:53 test-classes
Uploading artifacts for successful job
00:01
Uploading artifacts...
WARNING: springboot.jar: no matching files. Ensure that the artifact path is relative to the working directory 
ERROR: No files to upload                          
Cleaning up project directory and file based variables
00:00
Job succeeded

Dockerfile

FROM openjdk:latest
MAINTAINER vdoma.de
VOLUME /tmp
ADD target/springboot.jar  app.jar
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]

Docker 構建失敗,因為找不到工件

Docker 日志錯誤

ADD failed: file not found in build context or excluded by .dockerignore: stat target/springboot.jar: file does not exist
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit code 1

有沒有人有同樣的問題?

maven-package:
  stage: package
  inherit:
    default: true
    variables: true
  script:
    - cd springboot
    - mvn clean package -P dev
    - cd target
    - ls -al
  artifacts:
    when: always
    paths:
      - springboot/target/springboot.jar
  tags:
    - docker
FROM openjdk:latest
MAINTAINER vdoma.de
VOLUME /tmp
COPY springboot/target/springboot.jar  app.jar
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM