开发者

Latest version of an artifact from Apache Archiva

开发者 https://www.devze.com 2023-03-28 11:54 出处:网络
Is there some kind of parametrize开发者_运维百科d url on archiva, where I can get the latest snapshot/release of an artifact?

Is there some kind of parametrize开发者_运维百科d 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


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


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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号