Gradle

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What’s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
To raise new issues or bugs against Gradle, please use forums.gradle.org.
  • Gradle
  • GRADLE-2100

Ordering of repository declarations can cause Could not resolve all dependencies error

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Resolution: Fixed
  • Affects Version/s: 1.0-milestone-8
  • Fix Version/s: 1.0-milestone-8a

Description

(See forum post: http://forums.gradle.org/gradle/topics/could_not_resolve_all_dependencies_error_with_m8)

Suppose I have a buildscript block that declares two repositories A and B (in that order), and then a standard repositories block that declares only repository B. And suppose that both the buildscript block and the standard dependencies block declare the same dependency.

apply plugin: 'java'

buildscript {
    repositories {
        maven { url "http://repository.springsource.com/maven/bundles/release" }
        maven { url "http://repo1.maven.org/maven2" }
    }
    dependencies {
        classpath 'org.springframework:spring-core:3.1.0.RELEASE'
    }
}

repositories {
    maven { url "http://repo1.maven.org/maven2" }
}

dependencies {
    compile 'org.springframework:spring-core:3.1.0.RELEASE'
}

If I manually clear the cache by deleting ~/.gradle/caches/{1.0-milestone-8,artifacts-8) and then run "gradle clean build", I will get the following error:

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all dependencies for configuration ':compile'.
> Could not find group:org.springframework, module:spring-core, version:3.1.0.RELEASE.
  Required by:
      :local:unspecified

Reversing the repository declarations in the buildscript block, manually clearing the cache, and re-running gradle results in a successful build.

If I use mavenCentral() instead of manually specifying the URL, there is no problem.

Per Daz on the forums:

It seems you have indeed exposed a fairly critical bug in dependency resolution: for some reason we're using the 'springsource' repository identifier in the second resolve, which causes us to use the cache entries for the incorrect repository. (The repository URL is correct, but the repository identifier is used to lookup entries in the cache).

Since the module is missing from the 'springsource' repository, it appears to be missing in the second resolve.

Issue Links

Superceded by

Bug - A problem which impairs or prevents the functions of the product. GRADLE-2101 Dependency resolution incorrectly uses cached values from different repository

  • Resolved - A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.

Activity

  • All
  • Comments
  • History
  • Activity
  • TeamCity
  • Commits
  • Source
  • Reviews
Hide
Permalink
Dan Stine added a comment - 21/Feb/12 8:50 AM

1.0-milestone-8a fixes this issue for me.

Show
Dan Stine added a comment - 21/Feb/12 8:50 AM 1.0-milestone-8a fixes this issue for me.

People

  • Assignee:
    Daz DeBoer
    Reporter:
    Dan Stine
Vote (1)
Watch (2)

Dates

  • Created:
    14/Feb/12 3:11 PM
    Updated:
    04/Jan/13 5:10 AM
    Resolved:
    16/Feb/12 4:25 PM
  • Atlassian JIRA (v5.0.3#729-sha1:bf569e4)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Gradle. Try JIRA - bug tracking software for your team.