[GRADLE-2369] Dependency resolution fails for mavenLocal(), mavenCentral() if artifact partially in mavenLocal() Created: 29/Jun/12  Updated: 23/Apr/14  Resolved: 09/Jul/12

Status: Resolved
Project: Gradle
Affects Version/s: 1.0
Fix Version/s: 1.9-rc-1

Type: Bug
Reporter: Rob Winch Assignee: Unassigned
Resolution: Duplicate Votes: 0

Attachments: Zip Archive gradle-objnotfound.zip    
Issue Links:
Duplicate
Duplicates GRADLE-2034 Existence of pom file requires that d... Resolved

 Description   

Summary

I ran into a strange scenario where my local repository only had the pom, pom.sha1, and _maven.repositories for a particular artifact (not the *.jar* files). When gradle tried to resolve the artifact it failed despite having both mavenLocal() and mavenCentral() listed.

I'm not certain how the scenario happened, but as far as I know it happened with standard maven tooling. As this issue took me a while to track down I thought I would take the time to report it in case others ran into it.

Reproducing

Here are the steps to reproduce. I have attached a project to assist in making it easier.

  1. Rename your local maven repository to ensure a fresh repository
  2. Unzip the sample project
  3. Run mvn package on the sample using Maven 3.0.4 (I don't think version matters)
  4. Remove org/objenesis/objenesis/1.2/*.jar* files from the maven local repository
  5. Run gradle build on the sample. The build will fail to resolve the dependencies despite having mavenCentral() as a repository too. You should see something like the following:
      FAILURE: Build failed with an exception.
    
      * What went wrong:
      Could not resolve all dependencies for configuration ':testRuntime'.
      > Artifact 'org.objenesis:objenesis:1.2@jar' not found.
      

Notes

  1. If you run again without mavenLocal() the error goes away
  2. I have included debug logs of dependency resolution working and of it failing in the attachment.


 Comments   
Comment by Rob Winch [ 05/Jul/12 ]

Thanks for pointing out the existing issue. You can close this issue if that is you policy as I can confirm the linked issue is a duplicate.

Generated at Wed Jun 30 12:20:03 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.