0

I'm trying to use Maven command line (mvn) to download a JAR file.

This post helped me to get to this nice command:

mvn dependency:get -Dartifact=<group>:<artifact-name>:<version> -DremoteRepositories=...

But I still could not figure out how to pass an auth token (since it is a private repository).

I also tryied to append -DhttpHeader="Authorization: Bearer ..." with no success, but I don't remember where did I get this.

How can I set an authorization token for it, please?

heringer
  • 2,698
  • 1
  • 20
  • 33
  • 1
    Since [MDEP-495](https://issues.apache.org/jira/browse/MDEP-495), `dependency:get` no longer supports `repoUrl`. – Joe Dec 08 '21 at 13:57
  • Thanks @Joe. I also tried `-DremoteRepositories=`. I will edit the post. – heringer Dec 08 '21 at 16:39
  • 1
    The documentation: https://maven.apache.org/plugins/maven-dependency-plugin/get-mojo.html (Authorization is usually done by `settings.xm` file..)... – khmarbaise Dec 09 '21 at 06:17
  • Does this answer your question? [Modify Settings of POM file to support access tokens on Artifactory using maven](https://stackoverflow.com/questions/64999462/modify-settings-of-pom-file-to-support-access-tokens-on-artifactory-using-maven) – Joe Dec 09 '21 at 07:35
  • I think it would be a good idea to use maven, but in my use case I ended up quiting and I used wget successfully for my purposes (and auth). [This post](https://stackoverflow.com/questions/64969548/how-to-download-a-jar-from-github-package-registry-for-a-specific-release-versio/65071842?noredirect=1#comment124229506_65071842) helped me. – heringer Dec 09 '21 at 12:55
  • @Joe, I was looking for a command line argument. – heringer Dec 09 '21 at 12:58

0 Answers0