Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.0.1.RELEASE prevents Gradle Versions Plugin to resolve updated versions #155

Closed
igor-poteryaev opened this issue Mar 12, 2017 · 6 comments

Comments

@igor-poteryaev
Copy link

After upgrade from 1.0.0.RELEASE to 1.0.1.RELEASE I found that updated versions of dependencies, are not resolved.

Example project build.gradle :

plugins {
    // https://github.com/ben-manes/gradle-versions-plugin
    id "com.github.ben-manes.versions"          version "0.14.0"
    // https://github.com/spring-gradle-plugins/dependency-management-plugin
    id "io.spring.dependency-management"        version "1.0.1.RELEASE"
}
apply plugin: 'java'
apply plugin: "com.github.ben-manes.versions"
apply plugin: "io.spring.dependency-management"

compileJava {
    sourceCompatibility = JavaVersion.VERSION_1_8
    targetCompatibility = JavaVersion.VERSION_1_8
    options.encoding    = 'UTF-8'
}
version = '1.0'

dependencyManagement {
    dependencies {
        dependency group: 'junit',       name: 'junit',       version: '4.11'
        dependency group: 'commons-net', name: 'commons-net', version: '3.5'
    }
}

repositories {
    mavenCentral()
}

dependencies {
    compile     group: 'commons-net', name: 'commons-net', version: '3.4'
    testCompile group: 'junit',       name: 'junit',       version: '4.10'
}

With 1.0.0.RELEASE, updates are shown:

$ gradle dependencyUpdates
:dependencyUpdates

------------------------------------------------------------
: Project Dependency Updates (report to plain text file)
------------------------------------------------------------

The following dependencies are using the latest milestone version:
 - com.github.ben-manes:gradle-versions-plugin:0.14.0

The following dependencies have later milestone versions:
 - commons-net:commons-net [3.5 -> 3.6]
 - io.spring.gradle:dependency-management-plugin [1.0.0.RELEASE -> 1.0.1.RELEASE]
 - junit:junit [4.11 -> 4.12]

Generated report file build/dependencyUpdates/report.txt

BUILD SUCCESSFUL
Total time: 3.52 secs

With 1.0.1.RELEASE, updates are not shown:

$ gradle dependencyUpdates
:dependencyUpdates

------------------------------------------------------------
: Project Dependency Updates (report to plain text file)
------------------------------------------------------------

The following dependencies are using the latest milestone version:
 - commons-net:commons-net:3.5
 - io.spring.gradle:dependency-management-plugin:1.0.1.RELEASE
 - com.github.ben-manes:gradle-versions-plugin:0.14.0
 - junit:junit:4.11

Generated report file build/dependencyUpdates/report.txt

BUILD SUCCESSFUL

Total time: 2.506 secs

I guess that changed behavior is caused by this:
03237ef#diff-6b206b133732c66b5cfba81f3f218b49R55

Is it possible to restore updates resolution ?

Thanks and regards,
Igor

@wilkinsona
Copy link
Contributor

Oh dear. The change you referenced was intended to strike the right balance so that this would still work. I had thought that this test would cover this scenario.

Looks like I need to dig into the behaviour of the versions plugin again and see exactly how it does things.

@wilkinsona wilkinsona added this to the 1.0.2.RELEASE milestone Mar 12, 2017
@ben-manes
Copy link

I think its because beforeResolve actions aren't copied, which we discovered earlier. The update restricts when to allow dynamic versions. You should probably open a Github issue against Gradle and maybe they'll fix the Configuration copy routine.

@wilkinsona
Copy link
Contributor

I think its because beforeResolve actions aren't copied

Yeah, that's the problem. As a result directDependencies is empty so dependency management's applied to the configuration copy created by the Versions plugin. Some experimentation earlier today suggests that lazily populating directDependencies using the original configuration will fix the problem without needing a change in Gradle.

@wilkinsona
Copy link
Contributor

@igor-poteryaev Thanks for reporting this. It should be fixed in the latest 1.0.2 snapshot. If you'd like to try it out, the snapshots are available from https://repo.spring.io/plugins-snapshot.

@igor-poteryaev
Copy link
Author

igor-poteryaev commented Mar 13, 2017

It works now.
Thank you so much, Andy.

:dependencyUpdates

------------------------------------------------------------
: Project Dependency Updates (report to plain text file)
------------------------------------------------------------

The following dependencies are using the latest milestone version:
 - com.github.ben-manes:gradle-versions-plugin:0.14.0

The following dependencies exceed the version found at the milestone revision level:
 - io.spring.gradle:dependency-management-plugin [1.0.2.BUILD-SNAPSHOT <- 1.0.1.RELEASE]

The following dependencies have later milestone versions:
 - commons-net:commons-net [3.5 -> 3.6]
 - junit:junit [4.11 -> 4.12]

Generated report file build/dependencyUpdates/report.txt

BUILD SUCCESSFUL
Total time: 2.868 sec

@wilkinsona
Copy link
Contributor

Excellent. Thanks for testing the snapshot, @igor-poteryaev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants