Skip to content

Commit bc65f89

Browse files
authored
Remove deprecated Gradle configurations (#1427)
Switch uses of `compile` over to using `implementation` and `api` instead. Swapped some instances of using `runtime` to use `runtimeClasspath` as well. Additionally do some light tidying up.
1 parent 9d0dd7f commit bc65f89

File tree

10 files changed

+75
-80
lines changed

10 files changed

+75
-80
lines changed

buildSrc/src/main/groovy/org/elasticsearch/hadoop/gradle/BuildPlugin.groovy

Lines changed: 19 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ class BuildPlugin implements Plugin<Project> {
273273
}
274274

275275
project.configurations.compile.dependencies.all(disableTransitiveDeps)
276+
project.configurations.implementation.dependencies.all(disableTransitiveDeps)
276277
project.configurations.provided.dependencies.all(disableTransitiveDeps)
277278
project.configurations.optional.dependencies.all(disableTransitiveDeps)
278279
project.configurations.compileOnly.dependencies.all(disableTransitiveDeps)
@@ -289,31 +290,31 @@ class BuildPlugin implements Plugin<Project> {
289290

290291
// Detail all common dependencies
291292
project.dependencies {
292-
testCompile "junit:junit:${project.ext.junitVersion}"
293-
testCompile "org.hamcrest:hamcrest-all:${project.ext.hamcrestVersion}"
293+
testImplementation("junit:junit:${project.ext.junitVersion}")
294+
testImplementation("org.hamcrest:hamcrest-all:${project.ext.hamcrestVersion}")
294295

295-
testCompile "joda-time:joda-time:2.8"
296+
testImplementation("joda-time:joda-time:2.8")
296297

297-
testRuntime "org.slf4j:slf4j-log4j12:1.7.6"
298-
testRuntime "org.apache.logging.log4j:log4j-api:${project.ext.log4jVersion}"
299-
testRuntime "org.apache.logging.log4j:log4j-core:${project.ext.log4jVersion}"
300-
testRuntime "org.apache.logging.log4j:log4j-1.2-api:${project.ext.log4jVersion}"
301-
testRuntime "net.java.dev.jna:jna:4.2.2"
302-
testCompile "org.codehaus.groovy:groovy:${project.ext.groovyVersion}:indy"
303-
testRuntime "org.locationtech.spatial4j:spatial4j:0.6"
304-
testRuntime "com.vividsolutions:jts:1.13"
298+
testImplementation("org.slf4j:slf4j-log4j12:1.7.6")
299+
testImplementation("org.apache.logging.log4j:log4j-api:${project.ext.log4jVersion}")
300+
testImplementation("org.apache.logging.log4j:log4j-core:${project.ext.log4jVersion}")
301+
testImplementation("org.apache.logging.log4j:log4j-1.2-api:${project.ext.log4jVersion}")
302+
testImplementation("net.java.dev.jna:jna:4.2.2")
303+
testImplementation("org.codehaus.groovy:groovy:${project.ext.groovyVersion}:indy")
304+
testImplementation("org.locationtech.spatial4j:spatial4j:0.6")
305+
testImplementation("com.vividsolutions:jts:1.13")
305306

306307
// TODO: Remove when we merge ITests to test dirs
307308
itestCompile("org.apache.hadoop:hadoop-minikdc:${project.ext.minikdcVersion}") {
308309
// For some reason, the dependencies that are pulled in with MiniKDC have multiple resource files
309310
// that cause issues when they are loaded. We exclude the ldap schema data jar to get around this.
310311
exclude group: "org.apache.directory.api", module: "api-ldap-schema-data"
311312
}
312-
itestCompile project.sourceSets.main.output
313-
itestCompile project.configurations.testCompile
314-
itestCompile project.configurations.provided
315-
itestCompile project.sourceSets.test.output
316-
itestRuntime project.configurations.testRuntime
313+
itestImplementation(project.sourceSets.main.output)
314+
itestImplementation(project.configurations.testImplementation)
315+
itestImplementation(project.configurations.provided)
316+
itestImplementation(project.sourceSets.test.output)
317+
itestImplementation(project.configurations.testRuntimeClasspath)
317318
}
318319

319320
// Deal with the messy conflicts out there
@@ -575,18 +576,6 @@ class BuildPlugin implements Plugin<Project> {
575576
connection = 'scm:git:git://github.com/elastic/elasticsearch-hadoop'
576577
developerConnection = 'scm:git:git://github.com/elastic/elasticsearch-hadoop'
577578
}
578-
developers {
579-
developer {
580-
id = 'jbaiera'
581-
name = 'James Baiera'
582-
583-
}
584-
developer {
585-
id = 'costin'
586-
name = 'Costin Leau'
587-
588-
}
589-
}
590579
}
591580

592581
groupId = "org.elasticsearch"
@@ -757,7 +746,7 @@ class BuildPlugin implements Plugin<Project> {
757746

758747
if (!project.path.startsWith(":qa")) {
759748
TaskProvider<DependencyLicensesTask> dependencyLicenses = project.tasks.register('dependencyLicenses', DependencyLicensesTask.class) {
760-
dependencies = project.configurations.runtime.fileCollection {
749+
dependencies = project.configurations.runtimeClasspath.fileCollection {
761750
!(it instanceof ProjectDependency)
762751
}
763752
mapping from: /hadoop-.*/, to: 'hadoop'
@@ -780,7 +769,7 @@ class BuildPlugin implements Plugin<Project> {
780769
private static void configureDependenciesInfo(Project project) {
781770
if (!project.path.startsWith(":qa")) {
782771
project.tasks.register("dependenciesInfo", DependenciesInfoTask) { DependenciesInfoTask task ->
783-
task.runtimeConfiguration = project.configurations.getByName(JavaPlugin.RUNTIME_CONFIGURATION_NAME)
772+
task.runtimeConfiguration = project.configurations.getByName(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME)
784773
task.compileOnlyConfiguration = project.configurations.getByName(JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME)
785774
// Create a property called mappings that points to the same mappings in the dependency licenses task.
786775
task.getConventionMapping().map('mappings') {

buildSrc/src/main/groovy/org/elasticsearch/hadoop/gradle/IntegrationBuildPlugin.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class IntegrationBuildPlugin implements Plugin<Project> {
8888
// If this becomes a problem, we could see if there's a way to listen for new dependencies and add them
8989
// to root at the same time.
9090
project.afterEvaluate {
91-
project.getConfigurations().getByName('compile').getAllDependencies()
91+
project.getConfigurations().getByName('implementation').getAllDependencies()
9292
.withType(ExternalDependency.class)
9393
.each { Dependency dependency ->
9494
// Convert the scope to optional on the root project - it will have every integration in it, and

hive/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ dependencies {
99
provided(project(":elasticsearch-hadoop-mr"))
1010
provided(project(path: ":elasticsearch-hadoop-mr", configuration:"compile"))
1111

12-
testCompile project(":elasticsearch-hadoop-mr").sourceSets.test.runtimeClasspath
13-
itestCompile project(":elasticsearch-hadoop-mr").sourceSets.itest.runtimeClasspath
12+
testImplementation(project(":elasticsearch-hadoop-mr").sourceSets.test.runtimeClasspath)
13+
itestImplementation(project(":elasticsearch-hadoop-mr").sourceSets.itest.runtimeClasspath)
1414
}
1515

1616
jar {
@@ -37,10 +37,10 @@ dependencies {
3737
provided("org.apache.hive:hive-exec:$hiveVersion")
3838
provided("org.apache.hive:hive-metastore:$hiveVersion")
3939

40-
itestRuntime("org.apache.hive:hive-service:$hiveVersion") {
40+
itestImplementation("org.apache.hive:hive-service:$hiveVersion") {
4141
exclude module: "log4j-slf4j-impl"
4242
}
43-
itestRuntime("org.apache.hive:hive-jdbc:$hiveVersion") {
43+
itestImplementation("org.apache.hive:hive-jdbc:$hiveVersion") {
4444
exclude module: "log4j-slf4j-impl"
4545
}
4646
}

mr/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ dependencies {
1717
provided("org.codehaus.jackson:jackson-mapper-asl:${project.ext.jacksonVersion}")
1818
provided("org.codehaus.jackson:jackson-core-asl:${project.ext.jacksonVersion}")
1919

20-
testCompile(project.ext.hadoopClient)
21-
testCompile "io.netty:netty-all:4.0.29.Final"
22-
testCompile "org.elasticsearch:securemock:1.2"
20+
testImplementation(project.ext.hadoopClient)
21+
testImplementation("io.netty:netty-all:4.0.29.Final")
22+
testImplementation("org.elasticsearch:securemock:1.2")
2323
}
2424

2525
String generatedResources = "$buildDir/generated-resources/main"

pig/build.gradle

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ dependencies {
99
provided(project(":elasticsearch-hadoop-mr"))
1010
provided(project(path: ":elasticsearch-hadoop-mr", configuration:"compile"))
1111

12-
testCompile project(":elasticsearch-hadoop-mr").sourceSets.test.runtimeClasspath
13-
itestCompile project(":elasticsearch-hadoop-mr").sourceSets.itest.runtimeClasspath
12+
testImplementation(project(":elasticsearch-hadoop-mr").sourceSets.test.runtimeClasspath)
13+
itestImplementation(project(":elasticsearch-hadoop-mr").sourceSets.itest.runtimeClasspath)
1414
}
1515

1616
jar {
@@ -36,11 +36,11 @@ dependencies {
3636
provided("org.apache.pig:pig:$pigVersion:$pigClassifier")
3737
provided("joda-time:joda-time:$jodaVersion")
3838

39-
testRuntime("org.apache.pig:pig:$pigVersion:$pigClassifier")
40-
testRuntime("joda-time:joda-time:$jodaVersion")
39+
testImplementation("org.apache.pig:pig:$pigVersion:$pigClassifier")
40+
testImplementation("joda-time:joda-time:$jodaVersion")
4141

42-
testRuntime "com.google.guava:guava:11.0"
43-
testRuntime "jline:jline:0.9.94"
42+
testImplementation("com.google.guava:guava:11.0")
43+
testImplementation("jline:jline:0.9.94")
4444

45-
itestRuntime "dk.brics.automaton:automaton:1.11-8"
45+
itestImplementation("dk.brics.automaton:automaton:1.11-8")
4646
}

qa/kerberos/build.gradle

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,22 +48,23 @@ tasks.withType(ScalaCompile) { ScalaCompile task ->
4848
boolean localRepo = project.getProperties().containsKey("localRepo")
4949

5050
dependencies {
51-
compile project(":elasticsearch-hadoop-mr")
52-
compile project(":elasticsearch-storm")
51+
implementation(project(":elasticsearch-hadoop-mr"))
52+
implementation(project(":elasticsearch-storm"))
5353

54-
compile 'org.scala-lang:scala-library:2.11.8'
55-
compile project(":elasticsearch-spark-20")
54+
implementation('org.scala-lang:scala-library:2.11.12')
55+
implementation('org.scala-lang:scala-reflect:2.11.12')
56+
implementation(project(":elasticsearch-spark-20"))
5657

5758
compileOnly("com.fasterxml.jackson.module:jackson-module-scala_2.11:2.6.7.1")
5859
compileOnly("com.fasterxml.jackson.core:jackson-annotations:2.6.7")
5960
compileOnly("org.json4s:json4s-jackson_2.11:3.2.11")
6061
compileOnly("org.slf4j:slf4j-api:1.7.6")
6162

62-
compile("org.apache.hadoop:hadoop-client:${HadoopClusterConfiguration.HADOOP.defaultVersion()}")
63-
compile("org.apache.spark:spark-sql_2.11:$project.ext.spark20Version")
63+
implementation("org.apache.hadoop:hadoop-client:${HadoopClusterConfiguration.HADOOP.defaultVersion()}")
64+
implementation("org.apache.spark:spark-sql_2.11:$project.ext.spark20Version")
6465

65-
compile project(":elasticsearch-hadoop-mr").sourceSets.itest.runtimeClasspath
66-
compile project(":elasticsearch-storm").sourceSets.itest.runtimeClasspath
66+
implementation(project(":elasticsearch-hadoop-mr").sourceSets.itest.runtimeClasspath)
67+
implementation(project(":elasticsearch-storm").sourceSets.itest.runtimeClasspath)
6768

6869
kdcFixture project(':test:fixtures:minikdc')
6970

spark/sql-13/build.gradle

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ description = "Elasticsearch Spark (for Spark 1.3-1.6)"
33

44
evaluationDependsOn(':elasticsearch-hadoop-mr')
55

6+
apply plugin: 'java-library'
67
apply plugin: 'scala'
78
apply plugin: 'es.hadoop.build'
89
apply plugin: 'scala.variants'
@@ -88,10 +89,9 @@ eclipse {
8889

8990
dependencies {
9091
provided(project(":elasticsearch-hadoop-mr"))
91-
provided(project(path: ":elasticsearch-hadoop-mr", configuration:"compile"))
9292

93-
compile("org.scala-lang:scala-library:${project.ext.scalaVersion}")
94-
compile("org.scala-lang:scala-reflect:${project.ext.scalaVersion}")
93+
api("org.scala-lang:scala-library:${project.ext.scalaVersion}")
94+
api("org.scala-lang:scala-reflect:${project.ext.scalaVersion}")
9595

9696
provided("org.apache.spark:spark-core_${project.ext.scalaMajorVersion}:$sparkVersion") {
9797
exclude group: 'javax.servlet'
@@ -122,17 +122,17 @@ dependencies {
122122
exclude group: 'org.apache.hadoop'
123123
}
124124

125-
testCompile project(":elasticsearch-hadoop-mr").sourceSets.test.runtimeClasspath
126-
itestCompile project(":elasticsearch-hadoop-mr").sourceSets.itest.runtimeClasspath
125+
testImplementation(project(":elasticsearch-hadoop-mr").sourceSets.test.runtimeClasspath)
126+
itestImplementation(project(":elasticsearch-hadoop-mr").sourceSets.itest.runtimeClasspath)
127127

128-
testCompile("org.apache.spark:spark-core_${project.ext.scalaMajorVersion}:$sparkVersion") {
128+
testImplementation("org.apache.spark:spark-core_${project.ext.scalaMajorVersion}:$sparkVersion") {
129129
exclude group: 'javax.servlet'
130130
exclude group: 'org.apache.hadoop'
131131
}
132-
itestCompile("org.apache.spark:spark-streaming_${project.ext.scalaMajorVersion}:$sparkVersion") {
132+
itestImplementation("org.apache.spark:spark-streaming_${project.ext.scalaMajorVersion}:$sparkVersion") {
133133
exclude group: 'org.apache.hadoop'
134134
}
135-
testCompile("org.apache.spark:spark-sql_${project.ext.scalaMajorVersion}:$sparkVersion") {
135+
testImplementation("org.apache.spark:spark-sql_${project.ext.scalaMajorVersion}:$sparkVersion") {
136136
exclude group: 'org.apache.hadoop'
137137
}
138138
}
@@ -171,8 +171,14 @@ configurations.all { Configuration conf ->
171171
}
172172
}
173173
}
174-
175-
conf.exclude group: "org.mortbay.jetty"
174+
}
175+
configurations {
176+
testImplementation {
177+
exclude group: "org.mortbay.jetty"
178+
}
179+
itestImplementation {
180+
exclude group: "org.mortbay.jetty"
181+
}
176182
}
177183

178184
tasks.withType(ScalaCompile) {

spark/sql-20/build.gradle

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ description = "Elasticsearch Spark (for Spark 2.X)"
33

44
evaluationDependsOn(':elasticsearch-hadoop-mr')
55

6+
apply plugin: 'java-library'
67
apply plugin: 'scala'
78
apply plugin: 'es.hadoop.build.integration'
89
apply plugin: 'scala.variants'
@@ -93,10 +94,9 @@ eclipse {
9394

9495
dependencies {
9596
provided(project(":elasticsearch-hadoop-mr"))
96-
provided(project(path: ":elasticsearch-hadoop-mr", configuration:"compile"))
9797

98-
compile("org.scala-lang:scala-library:$scalaVersion")
99-
compile("org.scala-lang:scala-reflect:$scalaVersion")
98+
api("org.scala-lang:scala-library:$scalaVersion")
99+
api("org.scala-lang:scala-reflect:$scalaVersion")
100100

101101
provided("org.apache.spark:spark-core_${project.ext.scalaMajorVersion}:$sparkVersion") {
102102
exclude group: 'javax.servlet'
@@ -130,23 +130,23 @@ dependencies {
130130
exclude group: 'org.apache.hadoop'
131131
}
132132

133-
testCompile "org.elasticsearch:securemock:1.2"
134-
testCompile(project(":elasticsearch-hadoop-mr").sourceSets.test.output)
133+
testImplementation("org.elasticsearch:securemock:1.2")
134+
testImplementation(project(":elasticsearch-hadoop-mr").sourceSets.test.output)
135135

136-
itestCompile(project(":elasticsearch-hadoop-mr").sourceSets.itest.output)
136+
itestImplementation(project(":elasticsearch-hadoop-mr").sourceSets.itest.output)
137137

138-
testCompile(project.ext.hadoopClient)
139-
testCompile("org.apache.spark:spark-core_${project.ext.scalaMajorVersion}:$sparkVersion") {
138+
testImplementation(project.ext.hadoopClient)
139+
testImplementation("org.apache.spark:spark-core_${project.ext.scalaMajorVersion}:$sparkVersion") {
140140
exclude group: 'javax.servlet'
141141
exclude group: 'org.apache.hadoop'
142142
}
143-
itestCompile("org.apache.spark:spark-yarn_${project.ext.scalaMajorVersion}:$sparkVersion") {
143+
itestImplementation("org.apache.spark:spark-yarn_${project.ext.scalaMajorVersion}:$sparkVersion") {
144144
exclude group: 'org.apache.hadoop'
145145
}
146-
testCompile("org.apache.spark:spark-sql_${project.ext.scalaMajorVersion}:$sparkVersion") {
146+
testImplementation("org.apache.spark:spark-sql_${project.ext.scalaMajorVersion}:$sparkVersion") {
147147
exclude group: 'org.apache.hadoop'
148148
}
149-
itestCompile("org.apache.spark:spark-streaming_${project.ext.scalaMajorVersion}:$sparkVersion") {
149+
itestImplementation("org.apache.spark:spark-streaming_${project.ext.scalaMajorVersion}:$sparkVersion") {
150150
exclude group: 'org.apache.hadoop'
151151
}
152152
}

storm/build.gradle

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ evaluationDependsOn(':elasticsearch-hadoop-mr')
77

88
dependencies {
99
provided(project(":elasticsearch-hadoop-mr"))
10-
provided(project(path: ":elasticsearch-hadoop-mr", configuration:"compile"))
1110

12-
testCompile project(":elasticsearch-hadoop-mr").sourceSets.test.runtimeClasspath
13-
itestCompile project(":elasticsearch-hadoop-mr").sourceSets.itest.runtimeClasspath
11+
testImplementation(project(":elasticsearch-hadoop-mr").sourceSets.test.runtimeClasspath)
12+
itestImplementation(project(":elasticsearch-hadoop-mr").sourceSets.itest.runtimeClasspath)
1413
}
1514

1615
jar {
@@ -35,8 +34,8 @@ dependencies {
3534
exclude module: "log4j-slf4j-impl"
3635
}
3736

38-
itestCompile "com.google.guava:guava:16.0.1"
39-
itestRuntime "com.twitter:carbonite:1.4.0"
37+
itestImplementation("com.google.guava:guava:16.0.1")
38+
itestImplementation("com.twitter:carbonite:1.4.0")
4039
}
4140

4241
// add itest to Eclipse

test/fixtures/minikdc/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ repositories {
2424
}
2525

2626
dependencies {
27-
compile("org.apache.hadoop:hadoop-minikdc:${project.ext.minikdcVersion}") {
27+
implementation("org.apache.hadoop:hadoop-minikdc:${project.ext.minikdcVersion}") {
2828
// For some reason, the dependencies that are pulled in with MiniKDC have multiple resource files
2929
// that cause issues when they are loaded. We exclude the ldap schema data jar to get around this.
3030
exclude group: "org.apache.directory.api", module: "api-ldap-schema-data"

0 commit comments

Comments
 (0)