diff --git a/README.md b/README.md index f3e52b2..2347adc 100644 --- a/README.md +++ b/README.md @@ -68,9 +68,9 @@ dependencyRecommendations { dependencies { nebulaRecommenderBom 'netflix:platform:latest.release@pom' - compile 'com.google.guava:guava' // no version, version is recommended - compile 'commons-lang:commons-lang:2.6' // I know what I want, don't recommend - compile project.recommend('commmons-logging:commons-logging', 'myprops') // source the recommendation from the provider named myprops' + implementation 'com.google.guava:guava' // no version, version is recommended + implementation 'commons-lang:commons-lang:2.6' // I know what I want, don't recommend + implementation project.recommend('commmons-logging:commons-logging', 'myprops') // source the recommendation from the provider named myprops' } ``` @@ -107,18 +107,18 @@ apply plugin: 'nebula.dependency-recommender' group = 'netflix' -configurations { compile } +configurations { implementation } repositories { jcenter() } dependencies { - compile 'commons-configuration:commons-configuration:1.6' + implementation 'commons-configuration:commons-configuration:1.6' } publishing { publications { parent(MavenPublication) { // the transitive closure of this configuration will be flattened and added to the dependency management section - nebulaDependencyManagement.fromConfigurations { configurations.compile } + nebulaDependencyManagement.fromConfigurations { configurations.implementation } // alternative syntax when you want to explicitly add a dependency with no transitives nebulaDependencyManagement.withDependencies { 'manual:dep:1' } @@ -215,7 +215,7 @@ dependencyRecommendations { } dependencies { - compile 'commons-logging:commons-logging' // version 1.2 is selected + implementation 'commons-logging:commons-logging' // version 1.2 is selected } ``` @@ -229,7 +229,7 @@ dependencyRecommendations { } dependencies { - compile 'commons-logging:commons-logging:1.0' // version 1.0 is selected + implementation 'commons-logging:commons-logging:1.0' // version 1.0 is selected } ``` @@ -243,7 +243,7 @@ dependencyRecommendations { } dependencies { - compile 'commons-logging:commons-logging' // version 1.0 is selected + implementation 'commons-logging:commons-logging' // version 1.0 is selected } ``` @@ -262,8 +262,8 @@ dependencyRecommendations { } dependencies { - compile 'commons-logging:commons-logging' - compile 'commons-configuration:commons-configuration:1.6' + implementation 'commons-logging:commons-logging' + implementation 'commons-configuration:commons-configuration:1.6' } ``` @@ -278,7 +278,7 @@ dependencyRecommendations { } dependencies { - compile 'commons-configuration:commons-configuration:1.6' + implementation 'commons-configuration:commons-configuration:1.6' } ``` @@ -292,8 +292,8 @@ dependencyRecommendations { } dependencies { - compile 'commons-configuration:commons-configuration:1.6' - compile 'commons-logging:commons-logging' // version 1.1.1 is selected + implementation 'commons-configuration:commons-configuration:1.6' + implementation 'commons-logging:commons-logging' // version 1.1.1 is selected } ``` diff --git a/src/test/groovy/netflix/nebula/dependency/recommender/DependencyRecommendationsPluginMultiprojectCoreBomSupportSpec.groovy b/src/test/groovy/netflix/nebula/dependency/recommender/DependencyRecommendationsPluginMultiprojectCoreBomSupportSpec.groovy index e88953f..7a7a78f 100644 --- a/src/test/groovy/netflix/nebula/dependency/recommender/DependencyRecommendationsPluginMultiprojectCoreBomSupportSpec.groovy +++ b/src/test/groovy/netflix/nebula/dependency/recommender/DependencyRecommendationsPluginMultiprojectCoreBomSupportSpec.groovy @@ -48,13 +48,13 @@ class DependencyRecommendationsPluginMultiprojectCoreBomSupportSpec extends Inte def 'can use recommender across a multiproject'() { def a = addSubproject('a', '''\ dependencies { - compile 'test.nebula:foo' + implementation 'test.nebula:foo' } '''.stripIndent()) writeHelloWorld('a', a) def b = addSubproject('b', '''\ dependencies { - compile project(':a') + implementation project(':a') } '''.stripIndent()) writeHelloWorld('b', b) diff --git a/src/test/groovy/netflix/nebula/dependency/recommender/DependencyRecommendationsPluginSpec.groovy b/src/test/groovy/netflix/nebula/dependency/recommender/DependencyRecommendationsPluginSpec.groovy index 849740c..0caf55d 100644 --- a/src/test/groovy/netflix/nebula/dependency/recommender/DependencyRecommendationsPluginSpec.groovy +++ b/src/test/groovy/netflix/nebula/dependency/recommender/DependencyRecommendationsPluginSpec.groovy @@ -45,10 +45,10 @@ class DependencyRecommendationsPluginSpec extends IntegrationSpec { } project.dependencies { - compile 'com.google.guava:guava' + implementation 'com.google.guava:guava' } - def resolved = project.configurations.compile.incoming.resolutionResult + def resolved = project.configurations.compileClasspath.incoming.resolutionResult .allComponents.collect { it.moduleVersion } then: @@ -81,7 +81,7 @@ class DependencyRecommendationsPluginSpec extends IntegrationSpec { dependencies { nebulaRecommenderBom 'test.nebula.bom:testbom:1.0.0@pom' - compile 'test.nebula:foo' + implementation 'test.nebula:foo' } """.stripIndent() @@ -122,7 +122,7 @@ class DependencyRecommendationsPluginSpec extends IntegrationSpec { dependencies { nebulaRecommenderBom 'test.nebula.bom:testbom:2.0.0@pom' zinc 'test.nebula:foo:1.0.0' - compile 'test.nebula:foo' + implementation 'test.nebula:foo' } """.stripIndent() @@ -163,12 +163,12 @@ class DependencyRecommendationsPluginSpec extends IntegrationSpec { dependencies { nebulaRecommenderBom 'test.nebula.bom:testbom:1.0.0@pom' - compile 'test.nebula:foo' + implementation 'test.nebula:foo' } """.stripIndent() when: - def result = runTasksSuccessfully('dependencyInsight', '--configuration', 'compile', '--dependency', 'foo') + def result = runTasksSuccessfully('dependencyInsight', '--configuration', 'compileClasspath', '--dependency', 'foo') then: result.standardOutput.contains 'Recommending version 1.0.0 for dependency test.nebula:foo' @@ -201,8 +201,8 @@ class DependencyRecommendationsPluginSpec extends IntegrationSpec { dependencies { nebulaRecommenderBom 'test.nebula.bom:testbom:1.0.0@pom' - compile 'test.nebula:foo' - compile 'test.nebula:bar:1.0.0' + implementation 'test.nebula:foo' + implementation 'test.nebula:bar:1.0.0' } """.stripIndent() @@ -239,8 +239,8 @@ class DependencyRecommendationsPluginSpec extends IntegrationSpec { dependencies { nebulaRecommenderBom 'test.nebula.bom:testbom:1.0.0@pom' - compile 'test.nebula:foo' - compile 'test.nebula:bar:1.0.0' + implementation 'test.nebula:foo' + implementation 'test.nebula:bar:1.0.0' } """.stripIndent() @@ -283,7 +283,7 @@ class DependencyRecommendationsPluginSpec extends IntegrationSpec { dependencies { nebulaRecommenderBom 'test.nebula.bom:testbom:latest.release@pom' - compile 'test.nebula:foo' + implementation 'test.nebula:foo' } """.stripIndent() @@ -314,18 +314,18 @@ class DependencyRecommendationsPluginSpec extends IntegrationSpec { group = 'netflix' version = '1' - configurations { compile } + configurations { implementation } repositories { jcenter() } dependencies { - compile 'commons-configuration:commons-configuration:1.6' + implementation 'commons-configuration:commons-configuration:1.6' } publishing { publications { parent(MavenPublication) { - nebulaDependencyManagement.fromConfigurations { configurations.compile } + nebulaDependencyManagement.fromConfigurations { configurations.implementation } nebulaDependencyManagement.withDependencies { 'manual:dep:1' } artifactId = 'module-parent' @@ -454,10 +454,10 @@ class DependencyRecommendationsPluginSpec extends IntegrationSpec { } project.dependencies { - compile 'com.google.collections:google-collections' + implementation 'com.google.collections:google-collections' } - def resolutionResult = project.configurations.compile.incoming.resolutionResult + def resolutionResult = project.configurations.compileClasspath.incoming.resolutionResult def guava = resolutionResult.allDependencies.first() then: diff --git a/src/test/groovy/netflix/nebula/dependency/recommender/RecommendationProviderContainerSpec.groovy b/src/test/groovy/netflix/nebula/dependency/recommender/RecommendationProviderContainerSpec.groovy index 2ab0996..9e76026 100644 --- a/src/test/groovy/netflix/nebula/dependency/recommender/RecommendationProviderContainerSpec.groovy +++ b/src/test/groovy/netflix/nebula/dependency/recommender/RecommendationProviderContainerSpec.groovy @@ -28,12 +28,12 @@ class RecommendationProviderContainerSpec extends Specification { when: project.dependencies { - compile 'commons-logging:commons-logging' - compile 'com.google.guava:guava' + implementation 'commons-logging:commons-logging' + implementation 'com.google.guava:guava' } then: - project.configurations.compile.resolvedConfiguration.firstLevelModuleDependencies.collect { it.moduleVersion } == ['1.1', '18.0'] + project.configurations.compileClasspath.resolvedConfiguration.firstLevelModuleDependencies.collect { it.moduleVersion } == ['1.1', '18.0'] } def 'recommendation providers can be named and recommendations provided by name'() { @@ -45,11 +45,11 @@ class RecommendationProviderContainerSpec extends Specification { when: project.dependencies { - compile project.recommend('commons-logging:commons-logging', 'r2') + implementation project.recommend('commons-logging:commons-logging', 'r2') } then: - project.configurations.compile.resolvedConfiguration.firstLevelModuleDependencies.collect { it.moduleVersion } == ['1.0'] + project.configurations.compileClasspath.resolvedConfiguration.firstLevelModuleDependencies.collect { it.moduleVersion } == ['1.0'] } def 'transitive dependencies of providers are not calculated and therefore have no effect'() { @@ -61,12 +61,12 @@ class RecommendationProviderContainerSpec extends Specification { when: project.dependencies { - compile 'commons-logging:commons-logging' - compile 'logkit:logkit' + implementation 'commons-logging:commons-logging' + implementation 'logkit:logkit' } then: - project.configurations.compile.resolvedConfiguration.firstLevelModuleDependencies.collect { it.moduleVersion } == ['1.1', '2.0'] + project.configurations.compileClasspath.resolvedConfiguration.firstLevelModuleDependencies.collect { it.moduleVersion } == ['1.1', '2.0'] } def 'dependencies that already have versions are not overriden by providers'() { @@ -77,11 +77,11 @@ class RecommendationProviderContainerSpec extends Specification { when: project.dependencies { - compile 'commons-logging:commons-logging:1.0' + implementation 'commons-logging:commons-logging:1.0' } then: - project.configurations.compile.resolvedConfiguration.firstLevelModuleDependencies.collect { it.moduleVersion } == ['1.0'] + project.configurations.compileClasspath.resolvedConfiguration.firstLevelModuleDependencies.collect { it.moduleVersion } == ['1.0'] } def 'recommended versions can be asked of the dependencyRecommendations extension container directly'() { @@ -92,7 +92,7 @@ class RecommendationProviderContainerSpec extends Specification { when: project.dependencies { - compile 'commons-logging:commons-logging:1.0' + implementation 'commons-logging:commons-logging:1.0' } then: @@ -109,12 +109,12 @@ class RecommendationProviderContainerSpec extends Specification { when: project.dependencies { - compile 'commons-logging:commons-logging' - compile 'com.google.guava:guava' + implementation 'commons-logging:commons-logging' + implementation 'com.google.guava:guava' } then: - project.configurations.compile.resolvedConfiguration.firstLevelModuleDependencies.collect { it.moduleVersion } == ['1.1', '18.0'] + project.configurations.compileClasspath.resolvedConfiguration.firstLevelModuleDependencies.collect { it.moduleVersion } == ['1.1', '18.0'] } def 'subprojects inherit providers from parent'() { @@ -135,11 +135,11 @@ class RecommendationProviderContainerSpec extends Specification { when: subproject.dependencies { - compile 'commons-logging:commons-logging' + implementation 'commons-logging:commons-logging' } then: - subproject.configurations.compile.resolvedConfiguration.firstLevelModuleDependencies.collect { it.moduleVersion } == ['1.1'] + subproject.configurations.compileClasspath.resolvedConfiguration.firstLevelModuleDependencies.collect { it.moduleVersion } == ['1.1'] } def 'transitive dependency versions are not overriden by recommendations unless there is a corresponding first order dependency'() { @@ -151,11 +151,11 @@ class RecommendationProviderContainerSpec extends Specification { when: project.dependencies { - compile 'commons-configuration:commons-configuration:1.10' + implementation 'commons-configuration:commons-configuration:1.10' // no first order dependency on commons-logging, so the recommendation will not be effectual } - def commonsConfig = project.configurations.compile.resolvedConfiguration.firstLevelModuleDependencies.iterator().next() + def commonsConfig = project.configurations.compileClasspath.resolvedConfiguration.firstLevelModuleDependencies.iterator().next() def commonsLang = commonsConfig.children.find { it.moduleName == 'commons-logging' } then: @@ -171,11 +171,11 @@ class RecommendationProviderContainerSpec extends Specification { when: project.dependencies { - compile 'commons-configuration:commons-configuration:1.10' + implementation 'commons-configuration:commons-configuration:1.10' // no first order dependency on commons-logging, but still recommend with OverrideTransitives strategy } - def commonsConfig = project.configurations.compile.resolvedConfiguration.firstLevelModuleDependencies.iterator().next() + def commonsConfig = project.configurations.compileClasspath.resolvedConfiguration.firstLevelModuleDependencies.iterator().next() def commonsLang = commonsConfig.children.find { it.moduleName == 'commons-logging' } then: @@ -190,12 +190,12 @@ class RecommendationProviderContainerSpec extends Specification { when: project.dependencies { - compile 'commons-configuration:commons-configuration:1.10' - compile 'commons-logging:commons-logging' + implementation 'commons-configuration:commons-configuration:1.10' + implementation 'commons-logging:commons-logging' } then: - project.configurations.compile.resolvedConfiguration.firstLevelModuleDependencies + project.configurations.compileClasspath.resolvedConfiguration.firstLevelModuleDependencies .collect { it.moduleVersion } == ['1.10', '1.1.1'] } @@ -213,11 +213,11 @@ class RecommendationProviderContainerSpec extends Specification { } project.dependencies { - compile 'commons-logging:commons-logging' + implementation 'commons-logging:commons-logging' } then: - project.configurations.compile.resolvedConfiguration.firstLevelModuleDependencies.collect { it.moduleVersion } == ['1.1'] + project.configurations.compileClasspath.resolvedConfiguration.firstLevelModuleDependencies.collect { it.moduleVersion } == ['1.1'] } def 'excludes configurations'() { @@ -233,13 +233,13 @@ class RecommendationProviderContainerSpec extends Specification { when: project.dependencies { - compile 'commons-configuration:commons-configuration:1.10' + implementation 'commons-configuration:commons-configuration:1.10' // no first order dependency on commons-logging, but still recommend with OverrideTransitives strategy excluded 'commons-configuration:commons-configuration:1.10' // this one will be excluded from recommendations } - def commonsConfigCompile = project.configurations.compile.resolvedConfiguration.firstLevelModuleDependencies.iterator().next() + def commonsConfigCompile = project.configurations.compileClasspath.resolvedConfiguration.firstLevelModuleDependencies.iterator().next() def commonsLangCompile = commonsConfigCompile.children.find { it.moduleName == 'commons-logging' } def commonsConfigExcluded = project.configurations.excluded.resolvedConfiguration.firstLevelModuleDependencies.iterator().next() @@ -263,13 +263,13 @@ class RecommendationProviderContainerSpec extends Specification { when: project.dependencies { - compile 'commons-configuration:commons-configuration:1.10' + implementation 'commons-configuration:commons-configuration:1.10' // no first order dependency on commons-logging, but still recommend with OverrideTransitives strategy incrementalExcluded 'commons-configuration:commons-configuration:1.10' // this one will be excluded from recommendations } - def commonsConfigCompile = project.configurations.compile.resolvedConfiguration.firstLevelModuleDependencies.iterator().next() + def commonsConfigCompile = project.configurations.compileClasspath.resolvedConfiguration.firstLevelModuleDependencies.iterator().next() def commonsLangCompile = commonsConfigCompile.children.find { it.moduleName == 'commons-logging' } def commonsConfigExcluded = project.configurations.incrementalExcluded.resolvedConfiguration.firstLevelModuleDependencies.iterator().next() diff --git a/src/test/groovy/netflix/nebula/dependency/recommender/provider/MavenBomRecommendationProviderSpec.groovy b/src/test/groovy/netflix/nebula/dependency/recommender/provider/MavenBomRecommendationProviderSpec.groovy index 5d63b5c..2f67d85 100644 --- a/src/test/groovy/netflix/nebula/dependency/recommender/provider/MavenBomRecommendationProviderSpec.groovy +++ b/src/test/groovy/netflix/nebula/dependency/recommender/provider/MavenBomRecommendationProviderSpec.groovy @@ -242,7 +242,7 @@ class MavenBomRecommendationProviderSpec extends Specification { } project.dependencies { - compile 'example:foo' + implementation 'example:foo' } def recommendations = new MavenBomRecommendationProvider(project, 'nebulaRecommenderBom')