Issue with classifier support
patrikerdes opened this issue · 2 comments
When running gradlew useLatestVersions
in one of the example project, the correct results are not produced.
diff of the build.gradle file:
dependencies {
testCompile "junit:junit:$junitVersion"
compile "log4j:log4j:$log4jversion"
- compile "commons-codec:commons-codec:" + codecVersion
- compile group: 'commons-lang', name: 'commons-lang', version: '2.4'
+ compile "commons-codec:commons-codec:1.12: 'commons-lang', name: 'commons-lang', version: '2.4'
compile group: 'commons-logging', name: 'commons-logging', version: commonsLoggingVersion
}
As can be seen here, the commons-codec and commons-lang lines are kind of merged together into one line, which doesn't make sense at all.
This issue was introduced by PR #13, when reverting that commit I don't see this problem.
I've created following test to reproduce the issue:
// see https://github.com/patrikerdes/gradle-use-latest-versions-plugin/issues/21
void "don't merge lines, reproduce issue #21"() {
given:
buildFile << """
plugins {
id 'se.patrikerdes.use-latest-versions'
id 'com.github.ben-manes.versions' version '$CurrentVersions.VERSIONS'
}
apply plugin: 'java'
repositories {
mavenCentral()
}
def junitVersion = '4.0'
dependencies {
testCompile "junit:junit:" + junitVersion
compile group: 'log4j', name: 'log4j', version: '1.2.16'
compile group: 'commons-logging', name: 'commons-logging', version: '2.4'
}
"""
when:
useLatestVersions()
String updatedBuildFile = buildFile.getText('UTF-8')
then:
updatedBuildFile.contains('testCompile "junit:junit:" + junitVersion')
updatedBuildFile.contains("compile group: 'log4j', name: 'log4j', version: '$CurrentVersions.LOG4J'")
}
As expected it fails, but it looks like this test is failing already for much older versions. I've just checked out 36c3e7b (Update version to 0.2.0) and when I add the test there, the test also fails with:
Condition not satisfied:
updatedBuildFile.contains('testCompile "junit:junit:" + junitVersion')
| |
| false
plugins {
id 'se.patrikerdes.use-latest-versions'
id 'com.github.ben-manes.versions' version '0.20.0'
}
apply plugin: 'java'
repositories {
mavenCentral()
}
def junitVersion = '4.0'
dependencies {
testCompile "junit:junit:4.13-beta-2: 'log4j', name: 'log4j', version: '1.2.16'
compile group: 'commons-logging', name: 'commons-logging', version: '2.4'
}
at se.patrikerdes.ModuleUpdatesFunctionalTest.don't merge lines, reproduce issue #21(ModuleUpdatesFunctionalTest.groovy:205)
We should investigate further.
I'm not sure why it failed on 0.2.0.
What I did was reverting the commit for PR #13, and then I did not see the problem.
(git revert 7f2db3205e9c1cf01ba6ef986598879d527b2c2d
)