Using the Nexus rest API to get latest artifact version for given groupid/artifactId

后端 未结 6 1205
走了就别回头了
走了就别回头了 2020-11-27 14:53

I am trying to use the nexus REST api to get the latest version of a maven artifact. I am able to browse to the specific version I am looking for using http://repo.loc

6条回答
  •  天命终不由人
    2020-11-27 15:37

    The following URL will retrieve the latest version of log4j 1.2.x:

    http://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=log4j&a=log4j&v=LATEST

    Documented here

    Update

    Example using curl:

    curl -L "http://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=log4j&a=log4j&v=LATEST" -o log4j.jar
    

    Update for Log4j2

    Log4j 1.2 is EOL since summer 2015 and is known to be broken in Java 9.

    Here is the link for the Log4j artifacts:

    • log4j-api: https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=org.apache.logging.log4j&a=log4j-api&v=LATEST
    • log4j-core: https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=org.apache.logging.log4j&a=log4j-core&v=LATEST

提交回复
热议问题