Reputation: 877
There might be some times that we want to download a specific Maven artifact from repository to local drive. In my case, I would like to use a third party library published in Maven repository in a particular IDE. However, the IDE I use has no integration support for maven repository yet, therefore the only way to use this library is to download the artifact to my local drive. I'm a newbie for maven, any suggestions will be very appreciated. Thanks.
-----UPDATE------
I learned from other threads and realised I should use maven dependency plugin to download an artifact to local folder. In my case, I need to download google ARCore from maven repository. I search the ARCore at maven repository, and know that:
Category: com.google.ar, Group:core, version:1.1.0
So I used the following command line to download it:
mvn dependency:get -Dartifact=com.google.ar:core:1.1.0
However, it failed to download the artifact, the error message is like:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:get (default-cli) on project standalone-pom: Couldn't download artifact: Missing:
[ERROR] ----------
[ERROR] 1) com.google.ar:core:jar:1.1.0
[ERROR]
[ERROR] Try downloading the file manually from the project website.
[ERROR]
[ERROR] Then, install it using the command:
[ERROR] mvn install:install-file -DgroupId=com.google.ar -DartifactId=core -Dversion=1.1.0 -Dpackaging=jar -Dfile=/path/to/file
[ERROR]
[ERROR] Alternatively, if you host your own repository you can deploy the file there:
[ERROR] mvn deploy:deploy-file -DgroupId=com.google.ar -DartifactId=core -Dversion=1.1.0 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[ERROR]
[ERROR] Path to dependency:
[ERROR] 1) org.apache.maven.plugins:maven-downloader-plugin:jar:1.0
[ERROR] 2) com.google.ar:core:jar:1.1.0
[ERROR]
[ERROR] ----------
[ERROR] 1 required artifact is missing.
Anyone can give a help? Thanks.
Upvotes: 0
Views: 5423
Reputation: 41
If you look at the documentation of the artifact option though: A string of the form groupId:artifactId:version[:packaging][:classifier]. Look at its last (optional) token, [:classifier]. I think That is what you are missing. try this one, mvn dependency:get -Dartifact=com.google.ar:core:1.1.0:jar:jar-with-dependencies
Upvotes: 1