0

I'm new to Maven, but the big picture is that I need to download (in command line) the POM file of a certain artifact which is in a remote maven repository (Artifactory) using just it's artifact name and making it dynamically (by giving only the repository root path and the name of the artifact, so I can change it's location inside the repository and still download it).

My first question is: is that possible, or I have to detail the whole artifact path, groupId, artifactId and version?

Second point: I managed to download the artifact using this maven command but it only gets the .jar, not the POM file:

mvn dependency:get -DrepoUrl=MY_REPO_LOC
                   -Dartifact=MY_ARTIFACT_LOC:MY_ARTIFACT_NAME:ARTIFACT_VERSION

Any idea on how can I do that?

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
Filipe P.
  • 1
  • 1
  • 1
  • 1
    Please try to add `-Dartifact=MY_ARTIFACT_LOC:MY_ARTIFACT_NAME:ARTIFACT_VERSION:pom`. – Charlee Chitsuk Apr 05 '13 at 11:48
  • Why are doing such strange thing? Do you like to use that artifact as a dependency? If yes just simply define a dependency in an other project to the appropriate artifact. – khmarbaise Apr 05 '13 at 13:17

1 Answers1

2

First, you don't need maven for that. You choose a binary repository, which can give you the solution directly. Here's how:

Since you don't know the location of the artifact (I'd assume in terms of repository name? Because all the rest is pretty much locked by Maven and you do know all the path if you know the GAVC) and you don't want to list the groupId and version, you have to search and be prepared to receive multiple results, on which you'll have to imply some logic to determine which one you need. Here's how you search in Artifactory from command line: http://wiki.jfrog.org/confluence/display/RTF/Artifactory%27s+REST+API#Artifactory%27sRESTAPI-SEARCHES I'd recommend GAVC Search, since you know the artifactId.

If it's only the version which is unknown, and you just want to get the latest version, you can just use the latest artifact retrieval call or latest version search.

JBaruch
  • 22,610
  • 5
  • 62
  • 90
  • I completely abandoned my approach. Thanks anyway [JBaruch](http://stackoverflow.com/users/402053/jbaruch). – Filipe P. Apr 11 '13 at 09:42