anu gupta
anu gupta

Reputation: 117

Add jar downloaded from xyz url directly into gitlab(gitlab-ci.yml) artifact

I am working on CI/CD setting for maven project. In which all dependent jars getting download into .m2 of gitlab from repository. However one of my required jar are not present in the repository, that I am having in my local window system.

How I can add that jar into the gitlab artifact from my local system or from some external url? Please suggest.

Upvotes: 0

Views: 855

Answers (1)

MrBerta
MrBerta

Reputation: 2758

If your GitLab job is executed on a runner that has access to the Internet, then you can download files directly in your job:

myjob:
  script:
    - wget http://example.com/path/to/myjar.jar
  artifacts:
    paths:
      - myjar.jar

If your running is running powershell:

myjob:
  script:
    - Invoke-WebRequest -Uri "http://example.com/path/to/myjar.jar" -OutFile myjar.jar
  artifacts:
    paths:
      - myjar.jar

You can also add wget/Invoke-WebRequest into your normal build jobs, to be able to get it into the same artifact as the rest of your build.

Upvotes: 2

Related Questions