Chris Dail
Chris Dail

Reputation: 26029

Download latest release from Artifactory with Gradle

Artifactory has a feature of their API where you can download the latest release of a jar file (See http://www.jfrog.com/confluence/display/RTF/Artifactory+REST+API#ArtifactoryRESTAPI-RetrieveLatestArtifact).

Their example is: GET http://localhost:8080/artifactory/ivy-local/org/acme/[RELEASE]/acme-[RELEASE].jar

I'm working on a project where all builds get published and I want to grab the jar from the last one. So what I'm looking for is a dependency like this in gradle:

compile "org.acme:acme:1.0.0.9.[RELEASE]"

This fails due to escaping of the square brackets so I tried:

compile "org.acme:acme:1.0.0.9.%5BRELEASE%5D"

This seems to allow gradle/ivy to find the file but it fails because the .pom file version does not match what is defined.

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all dependencies for configuration ':project:compile'.
> Could not resolve org.acme:acme:1.0.0.9.%5BRELEASE%5D.
  Required by:
      org.acme:acme:unspecified
   > Could not resolve org.acme:acme:1.0.0.9.%5BRELEASE%5D.
      > inconsistent module metadata found. Descriptor: CachedResource: /Users/xxxx/.gradle/caches/artifacts-26/filestore/org.acme/acme/1.0.0.9.%5BRELEASE%5D/pom/3986d9c1a27873ce92c0dbd089fc1ca9618f8c1a/acme-1.0.0.9.%5BRELEASE%5D.pom for http://localhost/artifactory/org/acme/acme/1.0.0.9.%5BRELEASE%5D/acme-1.0.0.9.%5BRELEASE%5D.pom Errors: bad version: expected='1.0.0.9.%5BRELEASE%5D' found='1.0.0.9.80'

Is there any way to get gradle and ivy to pull the latest release from artifactory?

Upvotes: 1

Views: 1601

Answers (1)

Chris Dail
Chris Dail

Reputation: 26029

I was able to get this working using the ivy syntax:

compile "org.acme:acme:1.0.0.9.+"

This solves the problem I have but I never did manage to get it working using the Artifactory [RELEASE] url.

Upvotes: 1

Related Questions