Build: Remove transitive dependencies

Transitive dependencies can be confusing and hard to deal with when
conflicts arise between them. This change removes transitive
dependencies from elasticsearch, and forces any dependency conflicts to
be resolved manually, instead of automatically by gradle.

closes #14627
This commit is contained in:
Ryan Ernst 2015-11-10 14:58:46 -08:00
parent 4cd8d0a815
commit 4b5f87cb7d
26 changed files with 144 additions and 56 deletions

View File

@ -114,7 +114,7 @@ subprojects {
configurations { configurations {
all { all {
resolutionStrategy { resolutionStrategy {
//failOnVersionConflict() failOnVersionConflict()
dependencySubstitution { dependencySubstitution {
substitute module("org.elasticsearch:rest-api-spec:${version}") with project("${projectsPrefix}:rest-api-spec") substitute module("org.elasticsearch:rest-api-spec:${version}") with project("${projectsPrefix}:rest-api-spec")

View File

@ -19,6 +19,7 @@
package org.elasticsearch.gradle package org.elasticsearch.gradle
import org.elasticsearch.gradle.precommit.PrecommitTasks import org.elasticsearch.gradle.precommit.PrecommitTasks
import org.gradle.api.artifacts.ProjectDependency
import org.gradle.api.GradleException import org.gradle.api.GradleException
import org.gradle.api.JavaVersion import org.gradle.api.JavaVersion
import org.gradle.api.Plugin import org.gradle.api.Plugin
@ -28,7 +29,6 @@ import org.gradle.api.artifacts.dsl.RepositoryHandler
import org.gradle.api.tasks.bundling.Jar import org.gradle.api.tasks.bundling.Jar
import org.gradle.api.tasks.compile.JavaCompile import org.gradle.api.tasks.compile.JavaCompile
import org.gradle.util.GradleVersion import org.gradle.util.GradleVersion
import org.gradle.util.VersionNumber
/** /**
* Encapsulates build configuration for elasticsearch projects. * Encapsulates build configuration for elasticsearch projects.
@ -48,6 +48,7 @@ class BuildPlugin implements Plugin<Project> {
project.pluginManager.apply('nebula.info-scm') project.pluginManager.apply('nebula.info-scm')
project.pluginManager.apply('nebula.info-jar') project.pluginManager.apply('nebula.info-jar')
configureConfigurations(project)
project.ext.versions = VersionProperties.versions project.ext.versions = VersionProperties.versions
configureCompile(project) configureCompile(project)
configureJarManifest(project) configureJarManifest(project)
@ -80,6 +81,23 @@ class BuildPlugin implements Plugin<Project> {
} }
} }
/** Makes dependencies non-transitive by default */
static void configureConfigurations(Project project) {
// force all dependencies added directly to compile/testCompile to be non-transitive, except for ES itself
project.configurations.compile.dependencies.all { dep ->
if (!(dep instanceof ProjectDependency) && dep.getGroup() != 'org.elasticsearch') {
dep.transitive = false
}
}
project.configurations.testCompile.dependencies.all { dep ->
if (!(dep instanceof ProjectDependency) && dep.getGroup() != 'org.elasticsearch') {
dep.transitive = false
}
}
}
/** Adds repositores used by ES dependencies */
static void configureRepositories(Project project) { static void configureRepositories(Project project) {
RepositoryHandler repos = project.repositories RepositoryHandler repos = project.repositories
repos.mavenCentral() repos.mavenCentral()

View File

@ -15,3 +15,6 @@ jna = 4.1.0
randomizedrunner = 2.2.0 randomizedrunner = 2.2.0
junit = 4.11 junit = 4.11
httpclient = 4.3.6 httpclient = 4.3.6
httpcore = 4.3.3
commonslogging = 1.1.3
commonscodec = 1.10

View File

@ -31,15 +31,19 @@ dependencies {
// lucene // lucene
compile "org.apache.lucene:lucene-core:${versions.lucene}" compile "org.apache.lucene:lucene-core:${versions.lucene}"
compile "org.apache.lucene:lucene-backward-codecs:${versions.lucene}"
compile "org.apache.lucene:lucene-analyzers-common:${versions.lucene}" compile "org.apache.lucene:lucene-analyzers-common:${versions.lucene}"
compile "org.apache.lucene:lucene-queries:${versions.lucene}" compile "org.apache.lucene:lucene-backward-codecs:${versions.lucene}"
compile "org.apache.lucene:lucene-memory:${versions.lucene}" compile "org.apache.lucene:lucene-grouping:${versions.lucene}"
compile "org.apache.lucene:lucene-highlighter:${versions.lucene}" compile "org.apache.lucene:lucene-highlighter:${versions.lucene}"
compile "org.apache.lucene:lucene-queryparser:${versions.lucene}"
compile "org.apache.lucene:lucene-suggest:${versions.lucene}"
compile "org.apache.lucene:lucene-join:${versions.lucene}" compile "org.apache.lucene:lucene-join:${versions.lucene}"
compile "org.apache.lucene:lucene-memory:${versions.lucene}"
compile "org.apache.lucene:lucene-misc:${versions.lucene}"
compile "org.apache.lucene:lucene-queries:${versions.lucene}"
compile "org.apache.lucene:lucene-queryparser:${versions.lucene}"
compile "org.apache.lucene:lucene-sandbox:${versions.lucene}"
compile "org.apache.lucene:lucene-spatial:${versions.lucene}" compile "org.apache.lucene:lucene-spatial:${versions.lucene}"
compile "org.apache.lucene:lucene-spatial3d:${versions.lucene}"
compile "org.apache.lucene:lucene-suggest:${versions.lucene}"
compile 'org.elasticsearch:securesm:1.0' compile 'org.elasticsearch:securesm:1.0'
@ -56,10 +60,10 @@ dependencies {
// json and yaml // json and yaml
compile "com.fasterxml.jackson.core:jackson-core:${versions.jackson}" compile "com.fasterxml.jackson.core:jackson-core:${versions.jackson}"
compile "com.fasterxml.jackson.dataformat:jackson-dataformat-smile:${versions.jackson}" compile "com.fasterxml.jackson.dataformat:jackson-dataformat-smile:${versions.jackson}"
compile(group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: versions.jackson) { compile "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:${versions.jackson}"
exclude group: 'com.fasterxml.jackson.core', module: 'jackson-databind'
}
compile "com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:${versions.jackson}" compile "com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:${versions.jackson}"
compile "org.yaml:snakeyaml:1.15" // used by jackson yaml
// network stack // network stack
compile 'io.netty:netty:3.10.5.Final' compile 'io.netty:netty:3.10.5.Final'
// compression of transport protocol // compression of transport protocol

View File

@ -24,6 +24,7 @@ esplugin {
dependencies { dependencies {
compile "org.apache.lucene:lucene-analyzers-icu:${versions.lucene}" compile "org.apache.lucene:lucene-analyzers-icu:${versions.lucene}"
compile 'com.ibm.icu:icu4j:54.1'
} }
dependencyLicenses { dependencyLicenses {

View File

@ -24,6 +24,7 @@ esplugin {
dependencies { dependencies {
compile "org.apache.lucene:lucene-analyzers-phonetic:${versions.lucene}" compile "org.apache.lucene:lucene-analyzers-phonetic:${versions.lucene}"
compile 'commons-codec:commons-codec:1.10'
} }
dependencyLicenses { dependencyLicenses {

View File

@ -22,14 +22,33 @@ esplugin {
classname 'org.elasticsearch.plugin.discovery.azure.AzureDiscoveryPlugin' classname 'org.elasticsearch.plugin.discovery.azure.AzureDiscoveryPlugin'
} }
versions << [
'azure': '0.7.0',
'jersey': '1.13'
]
dependencies { dependencies {
compile('com.microsoft.azure:azure-management-compute:0.7.0') { compile "com.microsoft.azure:azure-management-compute:${versions.azure}"
exclude group: 'stax', module: 'stax-api' compile "com.microsoft.azure:azure-management:${versions.azure}"
} compile "com.microsoft.azure:azure-core:${versions.azure}"
compile('com.microsoft.azure:azure-management:0.7.0') {
exclude group: 'stax', module: 'stax-api'
}
compile "org.apache.httpcomponents:httpclient:${versions.httpclient}" compile "org.apache.httpcomponents:httpclient:${versions.httpclient}"
compile "org.apache.httpcomponents:httpcore:${versions.httpcore}"
compile "commons-logging:commons-logging:${versions.commonslogging}"
compile "commons-codec:commons-codec:${versions.commonscodec}"
compile 'javax.mail:mail:1.4.5'
compile 'javax.activation:activation:1.1'
compile 'javax.inject:javax.inject:1'
compile "com.sun.jersey:jersey-client:${versions.jersey}"
compile "com.sun.jersey:jersey-core:${versions.jersey}"
compile "com.sun.jersey:jersey-json:${versions.jersey}"
compile 'org.codehaus.jettison:jettison:1.1'
compile 'com.sun.xml.bind:jaxb-impl:2.2.3-1'
compile 'javax.xml.bind:jaxb-api:2.2.2'
compile 'javax.xml.stream:stax-api:1.0-2'
compile 'org.codehaus.jackson:jackson-core-asl:1.9.2'
compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.2'
compile 'org.codehaus.jackson:jackson-jaxrs:1.9.2'
compile 'org.codehaus.jackson:jackson-xc:1.9.2'
} }
dependencyLicenses { dependencyLicenses {

View File

@ -0,0 +1 @@
4b95f4897fa13f2cd904aee711aeafc0c5295cd8

View File

@ -1 +0,0 @@
b7f0fc8f61ecadeb3695f0b9464755eee44374d4

View File

@ -22,9 +22,19 @@ esplugin {
classname 'org.elasticsearch.plugin.discovery.ec2.Ec2DiscoveryPlugin' classname 'org.elasticsearch.plugin.discovery.ec2.Ec2DiscoveryPlugin'
} }
versions << [
'aws': '1.10.19'
]
dependencies { dependencies {
compile 'com.amazonaws:aws-java-sdk-ec2:1.10.19' compile "com.amazonaws:aws-java-sdk-ec2:${versions.aws}"
compile "com.amazonaws:aws-java-sdk-core:${versions.aws}"
compile "org.apache.httpcomponents:httpclient:${versions.httpclient}" compile "org.apache.httpcomponents:httpclient:${versions.httpclient}"
compile "org.apache.httpcomponents:httpcore:${versions.httpcore}"
compile "commons-logging:commons-logging:${versions.commonslogging}"
compile "commons-codec:commons-codec:${versions.commonscodec}"
compile 'com.fasterxml.jackson.core:jackson-databind:2.5.3'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.5.0'
} }
dependencyLicenses { dependencyLicenses {

View File

@ -0,0 +1 @@
4b95f4897fa13f2cd904aee711aeafc0c5295cd8

View File

@ -1 +0,0 @@
b7f0fc8f61ecadeb3695f0b9464755eee44374d4

View File

@ -4,11 +4,21 @@ esplugin {
classname 'org.elasticsearch.plugin.discovery.gce.GceDiscoveryPlugin' classname 'org.elasticsearch.plugin.discovery.gce.GceDiscoveryPlugin'
} }
versions << [
'google': '1.20.0'
]
dependencies { dependencies {
compile('com.google.apis:google-api-services-compute:v1-rev71-1.20.0') { compile "com.google.apis:google-api-services-compute:v1-rev71-${versions.google}"
exclude group: 'com.google.guava', module: 'guava-jdk5' compile "com.google.api-client:google-api-client:${versions.google}"
} compile "com.google.oauth-client:google-oauth-client:${versions.google}"
compile "com.google.http-client:google-http-client:${versions.google}"
compile "com.google.http-client:google-http-client-jackson2:${versions.google}"
compile 'com.google.code.findbugs:jsr305:1.3.9'
compile "org.apache.httpcomponents:httpclient:${versions.httpclient}" compile "org.apache.httpcomponents:httpclient:${versions.httpclient}"
compile "org.apache.httpcomponents:httpcore:${versions.httpcore}"
compile "commons-logging:commons-logging:${versions.commonslogging}"
compile "commons-codec:commons-codec:${versions.commonscodec}"
} }
dependencyLicenses { dependencyLicenses {

View File

@ -0,0 +1 @@
4b95f4897fa13f2cd904aee711aeafc0c5295cd8

View File

@ -1 +0,0 @@
b7f0fc8f61ecadeb3695f0b9464755eee44374d4

View File

@ -24,6 +24,9 @@ esplugin {
dependencies { dependencies {
compile "org.apache.lucene:lucene-expressions:${versions.lucene}" compile "org.apache.lucene:lucene-expressions:${versions.lucene}"
compile 'org.antlr:antlr4-runtime:4.5.1-1'
compile 'org.ow2.asm:asm:5.0.4'
compile 'org.ow2.asm:asm-commons:5.0.4'
} }
dependencyLicenses { dependencyLicenses {

View File

@ -18,34 +18,48 @@
*/ */
esplugin { esplugin {
name 'mapper-attachments'
description 'The mapper attachments plugin adds the attachment type to Elasticsearch using Apache Tika.' description 'The mapper attachments plugin adds the attachment type to Elasticsearch using Apache Tika.'
classname 'org.elasticsearch.mapper.attachments.MapperAttachmentsPlugin' classname 'org.elasticsearch.mapper.attachments.MapperAttachmentsPlugin'
} }
versions << [
'tika': '1.11',
'pdfbox': '1.8.10',
'bouncycastle': '1.52',
'poi': '3.13'
]
dependencies { dependencies {
// mandatory for tika // mandatory for tika
compile('org.apache.tika:tika-core:1.11') compile "org.apache.tika:tika-core:${versions.tika}"
compile('org.apache.tika:tika-parsers:1.11') { compile "org.apache.tika:tika-parsers:${versions.tika}"
transitive = false compile 'commons-io:commons-io:2.4'
}
compile('commons-io:commons-io:2.4')
// character set detection // character set detection
compile('com.googlecode.juniversalchardet:juniversalchardet:1.0.3') compile 'com.googlecode.juniversalchardet:juniversalchardet:1.0.3'
// external parser libraries // external parser libraries
// HTML // HTML
compile('org.ccil.cowan.tagsoup:tagsoup:1.2.1') compile 'org.ccil.cowan.tagsoup:tagsoup:1.2.1'
// Adobe PDF // Adobe PDF
compile('org.apache.pdfbox:pdfbox:1.8.10') compile "org.apache.pdfbox:pdfbox:${versions.pdfbox}"
compile('org.bouncycastle:bcmail-jdk15on:1.52') compile "org.apache.pdfbox:fontbox:${versions.pdfbox}"
compile "org.apache.pdfbox:jempbox:${versions.pdfbox}"
compile 'commons-logging:commons-logging:1.1.3'
compile "org.bouncycastle:bcmail-jdk15on:${versions.bouncycastle}"
compile "org.bouncycastle:bcprov-jdk15on:${versions.bouncycastle}"
compile "org.bouncycastle:bcpkix-jdk15on:${versions.bouncycastle}"
// OpenOffice // OpenOffice
compile('org.apache.poi:poi-ooxml:3.13') compile "org.apache.poi:poi-ooxml:${versions.poi}"
compile "org.apache.poi:poi:${versions.poi}"
compile "org.apache.poi:poi-ooxml-schemas:${versions.poi}"
compile "commons-codec:commons-codec:${versions.commonscodec}"
compile 'org.apache.xmlbeans:xmlbeans:2.6.0'
compile 'stax:stax-api:1.0.1'
// MS Office // MS Office
compile('org.apache.poi:poi-scratchpad:3.13') compile "org.apache.poi:poi-scratchpad:${versions.poi}"
// Apple iWork // Apple iWork
compile('org.apache.commons:commons-compress:1.10') compile 'org.apache.commons:commons-compress:1.10'
} }
compileJava.options.compilerArgs << '-Xlint:-cast,-deprecation,-rawtypes' compileJava.options.compilerArgs << '-Xlint:-cast,-deprecation,-rawtypes'

View File

@ -0,0 +1 @@
4b95f4897fa13f2cd904aee711aeafc0c5295cd8

View File

@ -1 +0,0 @@
9ce04e34240f674bc72680f8b843b1457383161a

View File

@ -1 +0,0 @@
5043bfebc3db072ed80fbd362e7caf00e885d8ae

View File

@ -0,0 +1 @@
f6f66e966c70a83ffbdb6f17a0919eaf7c8aca7f

View File

@ -23,9 +23,8 @@ esplugin {
} }
dependencies { dependencies {
compile('com.microsoft.azure:azure-storage:2.0.0') { compile 'com.microsoft.azure:azure-storage:2.0.0'
exclude group: 'org.slf4j', module: 'slf4j-api' compile 'org.apache.commons:commons-lang3:3.3.2'
}
} }
dependencyLicenses { dependencyLicenses {

View File

@ -22,9 +22,20 @@ esplugin {
classname 'org.elasticsearch.plugin.repository.s3.S3RepositoryPlugin' classname 'org.elasticsearch.plugin.repository.s3.S3RepositoryPlugin'
} }
versions << [
'aws': '1.10.19'
]
dependencies { dependencies {
compile 'com.amazonaws:aws-java-sdk-s3:1.10.19' compile "com.amazonaws:aws-java-sdk-s3:${versions.aws}"
compile "com.amazonaws:aws-java-sdk-kms:${versions.aws}"
compile "com.amazonaws:aws-java-sdk-core:${versions.aws}"
compile "org.apache.httpcomponents:httpclient:${versions.httpclient}" compile "org.apache.httpcomponents:httpclient:${versions.httpclient}"
compile "org.apache.httpcomponents:httpcore:${versions.httpcore}"
compile "commons-logging:commons-logging:${versions.commonslogging}"
compile "commons-codec:commons-codec:${versions.commonscodec}"
compile "com.fasterxml.jackson.core:jackson-databind:2.5.3"
compile "com.fasterxml.jackson.core:jackson-annotations:2.5.0"
} }
dependencyLicenses { dependencyLicenses {

View File

@ -0,0 +1 @@
4b95f4897fa13f2cd904aee711aeafc0c5295cd8

View File

@ -1 +0,0 @@
b7f0fc8f61ecadeb3695f0b9464755eee44374d4

View File

@ -24,19 +24,14 @@ apply plugin: 'com.bmuschko.nexus'
dependencies { dependencies {
compile "org.elasticsearch:elasticsearch:${version}" compile "org.elasticsearch:elasticsearch:${version}"
compile "com.carrotsearch.randomizedtesting:randomizedtesting-runner:${versions.randomizedrunner}" compile "com.carrotsearch.randomizedtesting:randomizedtesting-runner:${versions.randomizedrunner}"
compile("junit:junit:${versions.junit}") { compile "junit:junit:${versions.junit}"
exclude group: 'org.hamcrest', module: 'hamcrest-core' compile 'org.hamcrest:hamcrest-all:1.3'
} compile "org.apache.lucene:lucene-test-framework:${versions.lucene}"
compile("org.apache.lucene:lucene-test-framework:${versions.lucene}") { compile "org.apache.lucene:lucene-codecs:${versions.lucene}"
exclude group: 'com.carrotsearch.randomizedtesting', module: 'junit4-ant' compile "org.apache.httpcomponents:httpclient:${versions.httpclient}"
} compile "org.apache.httpcomponents:httpcore:${versions.httpcore}"
compile('org.hamcrest:hamcrest-all:1.3') { compile "commons-logging:commons-logging:${versions.commonslogging}"
exclude group: 'org.hamcrest', module: 'hamcrest-core' compile "commons-codec:commons-codec:${versions.commonscodec}"
}
compile("org.apache.httpcomponents:httpclient:${versions.httpclient}") {
exclude group: 'commons-codec', module: 'commons-codec'
}
compile "commons-codec:commons-codec:1.9"
} }
compileJava.options.compilerArgs << '-Xlint:-cast,-deprecation,-fallthrough,-overrides,-rawtypes,-serial,-try,-unchecked' compileJava.options.compilerArgs << '-Xlint:-cast,-deprecation,-fallthrough,-overrides,-rawtypes,-serial,-try,-unchecked'