Artifactory - ?trace finds artifact, gradle does not

Hi all,

I posted to Stackoverflow at http://stackoverflow.com/questions/31600670/artifactory-trace-finds-artifact-gradle-does-not though I haven’t received any replies and I’m reaching out to try and find a solution and appreciate if anyone can suggest what may be going wrong here.

In summary to the below, gradle isn’t resolving Artifactory virtual repositories (libs-release) but will resolve an actual repository (libs-release-local). But if I use an actual repository then there is no connection to the remote-repos repository and the external dependencies won’t resolve. However I can hit the virtual repository URL in a browser, using Curl or with a ?trace to show Artifactory resolution and it works fine. I need to know why Gradle can’t resolve the dependency - what could be causing this?


When I gradle clean build the project with a dependency on an artifact in Artifactory gradle fails to find it. It errors with:

* What went wrong:
Could not resolve all dependencies for configuration ':compile'.
> Could not find apirCommon.jar (au.com.apir:apirCommon:1.0).
  Searched in the following locations:
	  http://devsvr:8090/artifactory/libs-release/au/com/apir/apirCommon/1.0/apirCommon-1.0.jar

I can hit this location with a browser or Curl to download the artifact or have a trace on it:

http://devsrv/artifactory/libs-release/au/com/apir/apirCommon/1.0/apirCommon-1.0.jar?trace

Request ID: 31810f1c
Repo Path ID: libs-release:au/com/apir/apirCommon/1.0/apirCommon-1.0.jar
Method Name: GET
User: admin
Time: 2015-07-24T11:07:22.236+10:00
Thread: http-bio-8090-exec-21
Steps: 
2015-07-24T11:07:22.236+10:00 Received request
2015-07-24T11:07:22.236+10:00 Request source = 203.a.b.c, Last modified = 01-01-70 09:59:59 +10:00, If modified since = -1, Thread name = http-bio-8090-exec-21
2015-07-24T11:07:22.236+10:00 Executing any BeforeDownloadRequest user plugins that may exist
2015-07-24T11:07:22.236+10:00 Retrieving info
2015-07-24T11:07:22.236+10:00 Consulting the virtual repo download strategy
2015-07-24T11:07:22.236+10:00 Trying to retrieve resource info from the local storage
2015-07-24T11:07:22.236+10:00 Unable to find resource in libs-release:au/com/apir/apirCommon/1.0/apirCommon-1.0.jar
2015-07-24T11:07:22.236+10:00 Searching for info in aggregated repositories
2015-07-24T11:07:22.236+10:00 Preparing list of aggregated repositories to search in
2015-07-24T11:07:22.236+10:00 Appending the virtual repository 'libs-release'
2015-07-24T11:07:22.236+10:00 Appending the virtual repository 'libs-release'
2015-07-24T11:07:22.236+10:00 Appending the virtual repository 'libs-release'
2015-07-24T11:07:22.236+10:00 Appending collective local repositories
2015-07-24T11:07:22.236+10:00 Appending collective local cache repositories
2015-07-24T11:07:22.236+10:00 Appending collective remote repositories
2015-07-24T11:07:22.236+10:00 Intercepting info request with 'PomInterceptor'
2015-07-24T11:07:22.236+10:00 Intercepting info request with 'MavenMetadataInterceptor'
2015-07-24T11:07:22.236+10:00 Processing request as a release resource
2015-07-24T11:07:22.236+10:00 Searching for the resource within libs-release-local
2015-07-24T11:07:22.237+10:00 Resource was found in libs-release-local
2015-07-24T11:07:22.237+10:00 Resource is an exact match - returning
2015-07-24T11:07:22.237+10:00 Returning resource as found in the aggregated repositories
2015-07-24T11:07:22.237+10:00 Intercepting found resource with 'PomInterceptor'
2015-07-24T11:07:22.237+10:00 Intercepting found resource with 'MavenMetadataInterceptor'
2015-07-24T11:07:22.237+10:00 Requested resource is found = true
2015-07-24T11:07:22.237+10:00 Request is HEAD = false
2015-07-24T11:07:22.237+10:00 Request is for a checksum = false
2015-07-24T11:07:22.237+10:00 Target repository is not remote or doesn't store locally = true
2015-07-24T11:07:22.237+10:00 Requested resource was not modified = false
2015-07-24T11:07:22.237+10:00 Responding with found resource
2015-07-24T11:07:22.237+10:00 Executing any AltResponse user plugins that may exist
2015-07-24T11:07:22.237+10:00 Alternative response status is set to -1 and message to 'null'
2015-07-24T11:07:22.237+10:00 Found no alternative content handles
2015-07-24T11:07:22.237+10:00 Retrieving a content handle from target repo
2015-07-24T11:07:22.237+10:00 The requested resource isn't pre-resolved
2015-07-24T11:07:22.237+10:00 Target repository isn't virtual - verifying that downloading is allowed
2015-07-24T11:07:22.237+10:00 Creating a resource handle from 'libs-release-local:au/com/apir/apirCommon/1.0/apirCommon-1.0.jar'
2015-07-24T11:07:22.237+10:00 Identified requested resource as a file
2015-07-24T11:07:22.237+10:00 Requested resource is an ordinary artifact - using normal content handle with length '13368639'
2015-07-24T11:07:22.237+10:00 Executing any BeforeDownload user plugins that may exist
2015-07-24T11:07:22.237+10:00 Responding with selected content handle
2015-07-24T11:07:22.237+10:00 Request succeeded

Why can’t Gradle download it? It isn’t being downloaded to my local .gradle cache.

http://stackoverflow.com/questions/20147980/gradle-could-not-resolve-dependency-from-artifactory has a similar problem though I am using the http://www.jfrog.com/confluence/display/RTF/Gradle+Artifactory+Plugin.

Any thoughts?


Update

I changed my repo from the virtual libs-release to the actual libs-release-local and it worked. I haven’t changed the configurations from the default in Artifactory and the virtual libs-release includes libs-release-local as a selected repository. Regardless, this virtual repository is resolved when going through curl, browser or ?trace, but not when going through Gradle. Why?

And other problem is that then the remote repositories (setup through the virtual libs-release) are never used so the build fails as it can’t find the remote artifacts.

1 Like

I fixed the problem by defining a new virtual repository that was exactly the same in every way (except for the name). Weird.