4

What I want to do is downloading one jar (foo.jar) and all dependencies of it into lib/ directory

mvn org.apache.maven.plugins:maven-dependency-plugin:2.10:get \
  -DremoteRepositories=http://nexus.example.com/content/groups/public/ \
  -Dartifact=com.example:foo:1.0-SNAPSHOT \
  -Ddest=/path/to/foo.jar

I also used -Dtransitive=true to download the transitive dependencies but it seems not working. I used copy-dependencies instead of get but it requires the current directory containing pom.xml namely a maven project here.

3
  • why do you want to do that? I mean that this "wget" approach is not the best way to use maven dependencies resolution system. Can you elaborate more the error you are getting? do you run this common from a project root folder?
    – Sammyrulez
    Commented Sep 22, 2016 at 7:21
  • @Sammyrulez I run this command in an empty directory. Actually I want to run the command in an arbitrary directory. After I run it I will get foo.jar and its dependent jars in lib directory. The reason I want do this is that I have a project when I package all dependencies it will be ~ 15MB. However the main code part is about 100KB.
    – bitdancer
    Commented Sep 22, 2016 at 7:27
  • 2
    and you want to release the dependencies and the "main jar" separately ? if the total size is 15MB I strongly suggest to ship it all together in a uber jar so you are in full control of future release and dependencies upgrades. If you still want to follow the separate release scenario I would go in adding the copy-dependencies goal to your packaging phase of your build.
    – Sammyrulez
    Commented Sep 22, 2016 at 8:22

1 Answer 1

1

You can download everything online from this site https://jar-download.com/online-maven-download-tool.php. This works for me.

1
  • Site is down and using external APIs Commented Jul 27, 2021 at 21:56

Not the answer you're looking for? Browse other questions tagged or ask your own question.