How to simply download a JAR using Maven?

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

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

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

    Maven does not work like that. Here's the closest you'll get to my knowledge:

    mvn dependency:get -DremoteRepositories=http://repo1.maven.org/maven2/ \
                       -DgroupId=junit -DartifactId=junit -Dversion=4.8.2 \
                       -Dtransitive=false
    

    Note that all parameters except transitive are required.
    Also note that Maven will download the jar to your local repository, and there's no sensible way (that I know of) to copy it to a local directory.

    Reference:

    • dependency:get

提交回复
热议问题