I don't have an internet connection at work, and I want to bring there a specific library.
So I want to be able to download at home an artifact along with all of its dependencies (recursively), in order to be able to take all of these jars and bring them to work.
I have read on this site about dependency:get
, which is great but downloads the artifacts to the local Maven repo (~/.m2/repository
). This means that after downloading, I need to look at pom
files and manually copy all of the dependent JAR files to some directory, which I can then bring to work.
I would love to have a way to simply download the desired JAR and all of its dependencies into a specific folder.
Is there a way to acheive this?
Please note: this question is different than the mentioned duplicate, in that I'm asking how to do this without any project or pom.xml
file. I'm looking for the simplest way to do this.
EDIT: I believe I found a possible solution (not the most elegant though..):
Rename the local repo (
~\.m2\repository
on my Windows machine) torepository.old
. Create an empty directoryrepository
at the same location instead.Run
mvn dependency:get -Dartifact=<groupid>:<artifactid>:<version>
This doesn't require a
pom.xml
or a project.The artifact and dependencies have been downloaded to your local previously-empty repository (
~\.m2\repository
).Move the local repository to wherever, and rename
repository.old
back torepository
.
(I think) you now have all the dependencies for your desired artifact.