How to simply download a JAR using Maven?

后端 未结 12 604
轮回少年
轮回少年 2020-12-04 10:14

How do I download JAR during a build in Maven script?

12条回答
  •  感动是毒
    2020-12-04 11:12

    It's possible to download a JAR from a Gitlab Maven private repository. The URL is appearing when running some Maven command so it's a bit hacky but it's working for me.

    Like this:

    wget --header "PRIVATE-TOKEN: ${GITLAB_PRIVATE_TOKEN}" "https://gitlab.com/api/v4/projects/${GITLAB_PROJECT_ID}/packages/maven/${MAVEN_PACKAGE_NAME}/${MAVEN_VERSION}/${JAR_FILE}"
    

    Where,

    • GITLAB_PRIVATE_TOKEN is a Gitlab Token with right "api" (atm the others are not enough)
      • GITLAB_PROJECT_ID e.g. 1462237
      • MAVEN_PACKAGE_NAME e.g. com/bar/foo
      • MAVEN_VERSION e.g. 0.0.1
      • JAR_FILE e.g. foo-0.0.1.jar

提交回复
热议问题