4

Is there some kind of parametrized url on archiva, where I can get the latest snapshot/release of an artifact? sth like https://myhappyarchiva.com/archiva/repository/com.example/com/example/myproject/LATEST/myproject-LATEST.jar

carlspring
  • 31,231
  • 29
  • 115
  • 197
sofarsogood
  • 291
  • 2
  • 13

2 Answers2

3

Try something like: "http://myhappyarchiva.com/archiva/restServices/archivaServices/searchService/artifact?r=#releases&g=com.myhappyarchiva&a=myproject&v=LATEST"

The basics are: "http://[host_name]/archiva/restServices/archivaServices/searchService/artifact?r=[release_option]&g=[group_id]&a=[artifact_id]&v=[version]&c=[classifer]"

  • [host_name] is like: dev.foo.com
  • [release_option] is like: "snapshots" or "releases"
  • [group_id] is like: com.foo
  • [version] is like: LATEST or some number like 1.0
  • [classifer] is like: javadoc, sources, or assembly

The labels are displayed in the tables on archiva. So you can easily look up the references.

I believe you can use "p" to be packaging as well. It can be like: "jar","pom","javadoc" basically file types. So that would look like, "&p=jar" added onto the request.

It you are following the requests it sometimes goes through a 307 temporary redirect and 302 found redirect before the repo starts to download.

You do this with curl or wget. Or in a script (I made a ruby script).

Example of wget: https://archiva.apache.org/docs/2.2.0/userguide/querying-artifacts.html

Jordan Stewart
  • 3,187
  • 3
  • 25
  • 37
2

That feature is not yet available, however you might like to file an issue at http://jira.codehaus.org/browse/MRM. A related issue is http://jira.codehaus.org/browse/MRM-805.

To achieve this today, the best thing to do is either:

  • use the XMLRPC interface to retrieve the versions and select the latest (you can use Maven libraries to do that if it's for Maven) [1] [2]
  • if you know the repository will be a Maven repository, you can grab the maven-metadata.xml file from Archiva and read the <release> or <latest> element
Brett Porter
  • 5,827
  • 27
  • 25
  • 2
    4 years later, is this possible yet? I am changing my url from a working 'com.example:library:2.0.300-SNAPSHOT' to 'com.example:library:2.0.*-SNAPSHOT', which does not work. :( – swooby Jul 28 '15 at 20:35
  • @Brett, we are also interested in this feature. Is it yet a feature of `Apache Archiva`? – Going Bananas Nov 10 '15 at 14:44
  • I think so... is this what you're looking for? https://issues.apache.org/jira/browse/MRM-1843 – Brett Porter Nov 10 '15 at 18:15