如何使用 Maven 简单地下载 JAR?

如何使用 Maven 简单地下载 JAR?

问题描述:

如何在构建 Maven 脚本期间下载 JAR?

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

Maven 不是这样工作的.这是您最接近我的知识:

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

请注意,除了传递参数之外的所有参数都是必需的.
另请注意,Maven 会将 jar 下载到您的本地存储库,并且没有明智的方法(据我所知)将其复制到本地目录.

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.

参考: