Remove misc dependency related deprecation warnings (7.x backport) (#59122)

* Fix dependency related deprecations (#58892)
* Fix classpath setup for forbiddenapi usage
This commit is contained in:
Rene Groeschke 2020-07-07 17:10:31 +02:00 committed by GitHub
parent eb169ae226
commit a896df53ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 31 additions and 43 deletions

View File

@ -37,8 +37,8 @@ dependencies {
api "org.openjdk.jmh:jmh-core:$versions.jmh" api "org.openjdk.jmh:jmh-core:$versions.jmh"
annotationProcessor "org.openjdk.jmh:jmh-generator-annprocess:$versions.jmh" annotationProcessor "org.openjdk.jmh:jmh-generator-annprocess:$versions.jmh"
// Dependencies of JMH // Dependencies of JMH
runtime 'net.sf.jopt-simple:jopt-simple:4.6' runtimeOnly 'net.sf.jopt-simple:jopt-simple:4.6'
runtime 'org.apache.commons:commons-math3:3.2' runtimeOnly 'org.apache.commons:commons-math3:3.2'
} }
// enable the JMH's BenchmarkProcessor to generate the final benchmark classes // enable the JMH's BenchmarkProcessor to generate the final benchmark classes

View File

@ -280,14 +280,6 @@ public class ElasticsearchJavaPlugin implements Plugin<Project> {
compilerArgs.add(targetCompatibilityVersion.getMajorVersion()); compilerArgs.add(targetCompatibilityVersion.getMajorVersion());
}); });
}); });
project.getPluginManager().withPlugin("com.github.johnrengelman.shadow", plugin -> {
// Ensure that when we are compiling against the "original" JAR that we also include any "shadow" dependencies on the compile
// classpath
Configuration shadowConfig = project.getConfigurations().getByName(ShadowBasePlugin.getCONFIGURATION_NAME());
Configuration apiConfig = project.getConfigurations().getByName(JavaPlugin.API_ELEMENTS_CONFIGURATION_NAME);
shadowConfig.getDependencies().all(dependency -> apiConfig.getDependencies().add(dependency));
});
} }
/** /**

View File

@ -84,8 +84,8 @@ sourceSets {
} }
dependencies { dependencies {
docCompile project(':server') docImplementation project(':server')
docCompile project(':modules:lang-painless') docImplementation project(':modules:lang-painless')
} }
testClusters { testClusters {

View File

@ -71,7 +71,7 @@ dependencies {
// Set the keytab files in the classpath so that we can access them from test code without the security manager // Set the keytab files in the classpath so that we can access them from test code without the security manager
// freaking out. // freaking out.
if (isEclipse == false) { if (isEclipse == false) {
testRuntime files(project(':test:fixtures:krb5kdc-fixture').ext.krb5Keytabs("hdfs", "hdfs_hdfs.build.elastic.co.keytab").parent) testRuntimeOnly files(project(':test:fixtures:krb5kdc-fixture').ext.krb5Keytabs("hdfs", "hdfs_hdfs.build.elastic.co.keytab").parent)
} }
} }

View File

@ -45,11 +45,11 @@ if (!isEclipse) {
} }
configurations { configurations {
java11Compile.extendsFrom(api) java11Implementation.extendsFrom(api)
} }
dependencies { dependencies {
java11Compile sourceSets.main.output java11Implementation sourceSets.main.output
} }
compileJava11Java { compileJava11Java {
@ -123,10 +123,6 @@ dependencies {
// repackaged jna with native bits linked against all elastic supported platforms // repackaged jna with native bits linked against all elastic supported platforms
api "org.elasticsearch:jna:${versions.jna}" api "org.elasticsearch:jna:${versions.jna}"
if (!isEclipse) {
java11Compile sourceSets.main.output
}
testImplementation(project(":test:framework")) { testImplementation(project(":test:framework")) {
// tests use the locally compiled version of server // tests use the locally compiled version of server
exclude group: 'org.elasticsearch', module: 'server' exclude group: 'org.elasticsearch', module: 'server'

View File

@ -25,7 +25,7 @@ dependencies {
} }
api project(':libs:elasticsearch-core') api project(':libs:elasticsearch-core')
api "com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:${versions.jackson}" api "com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:${versions.jackson}"
runtime "com.fasterxml.jackson.core:jackson-core:${versions.jackson}" runtimeOnly "com.fasterxml.jackson.core:jackson-core:${versions.jackson}"
testImplementation project(":test:framework") testImplementation project(":test:framework")
testImplementation project(path: xpackModule('core'), configuration: 'testArtifacts') testImplementation project(path: xpackModule('core'), configuration: 'testArtifacts')
} }

View File

@ -44,7 +44,7 @@ subprojects {
} }
testImplementation project(":test:framework") testImplementation project(":test:framework")
testRuntime project(path: xpackModule('sql:jdbc')) testRuntimeOnly project(path: xpackModule('sql:jdbc'))
} }
if (project.name != 'security') { if (project.name != 'security') {

View File

@ -30,7 +30,7 @@ dependencies {
api "org.jline:jline-reader:${jlineVersion}" api "org.jline:jline-reader:${jlineVersion}"
api "org.jline:jline-style:${jlineVersion}" api "org.jline:jline-style:${jlineVersion}"
testRuntime "org.elasticsearch:jna:${versions.jna}" testRuntimeOnly "org.elasticsearch:jna:${versions.jna}"
} }
/* disable unit tests because these are all integration tests used /* disable unit tests because these are all integration tests used
@ -55,7 +55,7 @@ subprojects {
configurations.testRuntimeClasspath { configurations.testRuntimeClasspath {
resolutionStrategy.force "org.slf4j:slf4j-api:1.7.25" resolutionStrategy.force "org.slf4j:slf4j-api:1.7.25"
} }
configurations.testRuntime { configurations.testRuntimeOnly {
// This is also required to make resolveAllDependencies work // This is also required to make resolveAllDependencies work
resolutionStrategy.force "org.slf4j:slf4j-api:1.7.25" resolutionStrategy.force "org.slf4j:slf4j-api:1.7.25"
} }
@ -70,35 +70,35 @@ subprojects {
testImplementation project(":test:framework") testImplementation project(":test:framework")
// JDBC testing dependencies // JDBC testing dependencies
testRuntime "net.sourceforge.csvjdbc:csvjdbc:${csvjdbcVersion}" testRuntimeOnly "net.sourceforge.csvjdbc:csvjdbc:${csvjdbcVersion}"
testRuntime "com.h2database:h2:${h2Version}" testRuntimeOnly "com.h2database:h2:${h2Version}"
// H2GIS testing dependencies // H2GIS testing dependencies
testRuntime("org.orbisgis:h2gis:${h2gisVersion}") { testRuntimeOnly("org.orbisgis:h2gis:${h2gisVersion}") {
exclude group: "org.locationtech.jts" exclude group: "org.locationtech.jts"
exclude group: "com.fasterxml.jackson.core" exclude group: "com.fasterxml.jackson.core"
} }
testRuntime project(path: xpackModule('sql:jdbc')) testRuntimeOnly project(path: xpackModule('sql:jdbc'))
testRuntime xpackProject('plugin:sql:sql-client') testRuntimeOnly xpackProject('plugin:sql:sql-client')
// CLI testing dependencies // CLI testing dependencies
testRuntime project(path: xpackModule('sql:sql-cli')) testRuntimeOnly project(path: xpackModule('sql:sql-cli'))
testRuntime(xpackProject('plugin:sql:sql-action')) { testRuntimeOnly(xpackProject('plugin:sql:sql-action')) {
transitive = false transitive = false
} }
testRuntime("org.jline:jline-terminal-jna:${jlineVersion}") { testRuntimeOnly("org.jline:jline-terminal-jna:${jlineVersion}") {
exclude group: "net.java.dev.jna" exclude group: "net.java.dev.jna"
} }
testRuntime "org.jline:jline-terminal:${jlineVersion}" testRuntimeOnly "org.jline:jline-terminal:${jlineVersion}"
testRuntime "org.jline:jline-reader:${jlineVersion}" testRuntimeOnly "org.jline:jline-reader:${jlineVersion}"
testRuntime "org.jline:jline-style:${jlineVersion}" testRuntimeOnly "org.jline:jline-style:${jlineVersion}"
testRuntime "org.elasticsearch:jna:${versions.jna}" testRuntimeOnly "org.elasticsearch:jna:${versions.jna}"
// spatial dependency // spatial dependency
testRuntime project(path: xpackModule('spatial')) testRuntimeOnly project(path: xpackModule('spatial'))
} }
if (project.name != 'security') { if (project.name != 'security') {

View File

@ -21,9 +21,9 @@ dependencies {
api xpackProject('plugin:sql:sql-proto') api xpackProject('plugin:sql:sql-proto')
api "org.apache.lucene:lucene-core:${versions.lucene}" api "org.apache.lucene:lucene-core:${versions.lucene}"
api "joda-time:joda-time:${versions.joda}" api "joda-time:joda-time:${versions.joda}"
runtime "com.fasterxml.jackson.core:jackson-core:${versions.jackson}" runtimeOnly "com.fasterxml.jackson.core:jackson-core:${versions.jackson}"
runtime "org.apache.logging.log4j:log4j-api:${versions.log4j}" runtimeOnly "org.apache.logging.log4j:log4j-api:${versions.log4j}"
runtime "org.apache.logging.log4j:log4j-core:${versions.log4j}" runtimeOnly "org.apache.logging.log4j:log4j-core:${versions.log4j}"
testImplementation project(":test:framework") testImplementation project(":test:framework")
} }

View File

@ -30,7 +30,7 @@ dependencies {
api xpackProject('plugin:sql:sql-action') api xpackProject('plugin:sql:sql-action')
api project(":libs:elasticsearch-cli") api project(":libs:elasticsearch-cli")
api project(':libs:elasticsearch-x-content') api project(':libs:elasticsearch-x-content')
runtime "org.elasticsearch:jna:${versions.jna}" runtimeOnly "org.elasticsearch:jna:${versions.jna}"
testImplementation project(":test:framework") testImplementation project(":test:framework")
} }

View File

@ -13,7 +13,7 @@ dependencies {
api( project(':libs:elasticsearch-x-content')) { api( project(':libs:elasticsearch-x-content')) {
transitive = false transitive = false
} }
runtime "com.fasterxml.jackson.core:jackson-core:${versions.jackson}" runtimeOnly "com.fasterxml.jackson.core:jackson-core:${versions.jackson}"
testImplementation project(":test:framework") testImplementation project(":test:framework")
} }

View File

@ -6,7 +6,7 @@ apply plugin: 'elasticsearch.rest-resources'
dependencies { dependencies {
testImplementation project(path: xpackModule('core'), configuration: 'testArtifacts') testImplementation project(path: xpackModule('core'), configuration: 'testArtifacts')
testImplementation project(path: xpackModule('stack'), configuration: 'runtime') testImplementation project(xpackModule('stack'))
} }
restResources { restResources {