How do I download JAR during a build in Maven script?
The Local Repository Maven's local repository is a directory on the local machine that stores all the project artifacts. When we execute a Maven build, Maven automatically downloads all the dependency jars into the local repository. Usually, this directory is named .
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
Or since 3.1, simply as mvn dependency:get -Dartifact=org.springframework:spring-instrument:3.2.3.RELEASE
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With