简体   繁体   中英

How to download Maven dependencies into a local repository, only from pom.xml, not from Maven itself

What I'd like to do is similar to the command below. The difference is that I don't want downloading dependencies of Maven itself.

mvn -f some-specific-pom.xml dependency:go-offline -Dmaven.repo.local=/some/specific/local/repo

In other words, I'd like Maven to use its own dependencies already in ~/.m2 for itself, and to download dependencies from some-specific-pom.xml into /some/specific/local/repo .

Does anyone know how to do it?

Using other tools is fine: such as Gradle. But, I'd like to keep the target directory ( /some/specific/local/repo ) structured as a Maven repository.


Once I run the command above for a new directory, it starts to download bulk of dependencies of Maven itself, such as maven-plugin-api-2.0.6.jar , maven-artifact-manager-2.0.6.jar , plexus-utils-3.0.5.jar , .... I wanted to skip the bunch of downloads.

Finally, I've solved this problem myself with Gradle and https://github.com/tehlers/gradle-download-dependencies-plugin . The downloadDependencies plugin helped this situation of mine. Thanks much to the author!

As my situation was a bit more special (I needed to download multiple versions of a same artifact), I've modified the Gradle plugin a bit, though.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM