0

I am trying to download JAR named mygroup-myid-myversion-jar-with-dependencies.jar from maven repository and tried commands

mvn -q org.apache.maven.plugins:maven-dependency-plugin:2.1:get -DrepoUrl=MYURL -Dartifact=mygroups:myid:myversion:jar-with-dependencies

mvn -q org.apache.maven.plugins:maven-dependency-plugin:2.1:get -DrepoUrl=MYURL -Dartifact=mygroups:myid:myversion-jar-with-dependencies

And both failed with error of being unable to find artifact.

Is this addendum called "classifier"?

How to donload JAR with classifier?

Dims
  • 47,675
  • 117
  • 331
  • 600
  • Check this one https://stackoverflow.com/a/7110499/1230748 – dcalap Oct 29 '18 at 11:56
  • Adding it as a dependency to your build? Of course not to forget the classifier ...? – khmarbaise Oct 29 '18 at 18:14
  • @khmarbaise I don't have any builds :) – Dims Oct 29 '18 at 19:13
  • The format of artifact is ` groupId:artifactId:version[:packaging[:classifier]].`...so this can't work...BTW: I recommend to use a more recent version of the [maven-dependency-plugin](https://maven.apache.org/plugins/maven-dependency-plugin/get-mojo.html) – khmarbaise Nov 01 '18 at 13:32

2 Answers2

1

Use -Dclassifier=<classifier> or -Dclassifiers=<classifiers> if you have more to download.

This worked for me:

mvn com.googlecode.maven-download-plugin:download-maven-plugin:artifact -DgroupId=org.jolokia -DartifactId=jolokia-jvm -Dversion=1.6.0 -Dclassifier=agent 
Sabir Khan
  • 9,826
  • 7
  • 45
  • 98
0

This one happened to me. I have a remote repository on one of the internet sites and our internal nexus are not getting those dependencies remotely from this host. We have a security setup that only nexus server can connect from outside world and our dev machines have no access to those kinds of remote repository hosts.

All of the artifacts are fine and can be downloaded via proxy repository but some are not, specially like this artifact with dependency classifier below.

<dependency>
    <groupId>com.asset</groupId>
    <artifactId>integration-adapter</artifactId>
    <version>1.28.76</version>
    <classifier>jar-with-dependencies</classifier>
</dependency>

Here are the steps that works for our development teams.

1.) As I'm admin I can remote download those problematic artifacts.

2.) From a secured host, make this file available.

3.) Follow this link from Nexus https://support.sonatype.com/hc/en-us/articles/213465818-How-can-I-programmatically-upload-an-artifact-into-Nexus-2-

4.) This is how I build/deploy to an internal repo so clients can download during their own specific builds for their projects.

mvn deploy:deploy-file -DgroupId=com.asset -DartifactId=integration-adapter -Dversion=1.28.76 -Dclassifier=jar-with-dependencies -DgeneratePom=true -Dpackaging=jar -DrepositoryId=nexus -Durl="http://your-nexus-host:8081/nexus/content/repositories/repo-releases/" -Dfile=integration-adapter-1.28.76-jar-with-dependencies.jar -DupdateReleaseInfo=true

Doing above way creates pom files and meta data in our corporate nexus so maven clients can download those artifacts.

5.) At your .pom file please add these dependencies below:

Looks like in this remote repository (the external host) these files were uploaded directly that is why there are missing maven pom files and we as consumers/clients cannot build it as normal with other working artifacts they have.

Note : So if your are publishing artifacts to the outside world and make your artifacts downloadable make sure you know and read on step 3 above.