Costin Leau 7584810ff4 * Make plugin hadoop2-only
Polish MiniDFS cluster to be Hadoop2 (instead of Hadoop1) based
2015-12-19 01:35:53 +02:00

167 lines
5.1 KiB
Groovy

/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
//apply plugin: 'nebula.provided-base'
esplugin {
description 'The HDFS repository plugin adds support for Hadoop Distributed File-System (HDFS) repositories.'
classname 'org.elasticsearch.plugin.hadoop.hdfs.HdfsPlugin'
}
versions << [
'hadoop2': '2.7.1'
]
configurations {
hadoop2
}
dependencies {
hadoop2 ("org.apache.hadoop:hadoop-client:${versions.hadoop2}") {
exclude module: "hadoop-yarn-common"
exclude module: "hadoop-mapreduce-client-app"
exclude module: "hadoop-mapreduce-client-core"
exclude module: "hadoop-mapreduce-client-jobclient"
exclude module: "hadoop-yarn-api"
exclude group: "commons-cli"
exclude group: "com.sun.jersey"
exclude group: "com.sun.jersey.contribs"
exclude group: "com.sun.jersey.jersey-test-framework"
exclude module: "guice"
exclude group: "org.mortbay.jetty"
exclude group: "tomcat"
exclude module: "commons-el"
exclude module: "hsqldb"
exclude group: "org.eclipse.jdt"
exclude module: "commons-beanutils"
exclude module: "commons-beanutils-core"
exclude module: "javax.servlet"
exclude module: "junit"
exclude module: "netty"
// provided by ES itself
exclude group: "log4j"
}
hadoop2 ("org.apache.hadoop:hadoop-hdfs:${versions.hadoop2}") {
// prevent jar hell
exclude module: "hadoop-yarn-common"
exclude module: "commons-cli"
exclude module: "netty"
exclude module: "guava"
exclude module: "junit"
// provided by ES itself
exclude group: "log4j"
}
provided "org.elasticsearch:elasticsearch:${versions.elasticsearch}"
provided configurations.hadoop2
testCompile ("org.apache.hadoop:hadoop-hdfs:${versions.hadoop2}:tests") {
exclude module: "commons-cli"
exclude module: "netty"
}
testCompile ("org.apache.hadoop:hadoop-common:${versions.hadoop2}:tests") {
exclude module: "commons-cli"
}
}
configurations.all {
// used due to _transitive_ configuration
resolutionStrategy {
force "commons-cli:commons-cli:1.3.1"
force "io.netty:netty:3.10.5.Final"
force "commons-codec:commons-codec:${versions.commonscodec}"
force "commons-logging:commons-logging:${versions.commonslogging}"
force "commons-lang:commons-lang:2.6"
force "commons-httpclient:commons-httpclient:3.0.1"
force "org.codehaus.jackson:jackson-core-asl:1.9.13"
force "org.codehaus.jackson:jackson-mapper-asl:1.9.13"
force "com.google.code.findbugs:jsr305:3.0.0"
force "com.google.guava:guava:16.0.1"
force "org.slf4j:slf4j-api:${versions.slf4j}"
force "org.slf4j:slf4j-log4j12:${versions.slf4j}"
force "junit:junit:${versions.junit}"
force "org.apache.httpcomponents:httpclient:4.3.6"
force "log4j:log4j:${versions.log4j}"
}
}
dependencyLicenses {
mapping from: /hadoop-.*/, to: 'hadoop'
}
compileJava.options.compilerArgs << '-Xlint:-deprecation,-rawtypes'
// main jar includes just the plugin classes
jar {
include "org/elasticsearch/plugin/hadoop/hdfs/*"
}
// hadoop jar (which actually depend on Hadoop)
task hadoopLinkedJar(type: Jar, dependsOn:jar) {
appendix "internal"
from sourceSets.main.output.classesDir
// exclude plugin
exclude "org/elasticsearch/plugin/hadoop/hdfs/*"
}
bundlePlugin.dependsOn hadoopLinkedJar
// configure 'bundle' as being w/o Hadoop deps
bundlePlugin {
into ("internal-libs") {
from hadoopLinkedJar.archivePath
}
into ("hadoop-libs") {
from configurations.hadoop2.allArtifacts.files
from configurations.hadoop2
}
}
task miniHdfsStart(type: JavaExec) {
classpath = sourceSets.test.compileClasspath + sourceSets.test.output
main = "org.elasticsearch.plugin.hadoop.hdfs.MiniHDFS"
errorOutput = new FileOutputStream("build/minihdfs.err")
standardOutput = new FileOutputStream("build/minihdfs.out")
//ext.hdfsPid = (main as Class).getPid
}
//task miniHdfsStop(type: org.elasticsearch.gradle.LoggedExec) {
// onlyIf { hdfsPid > -1 }
// if (Os.isFamily(Os.FAMILY_WINDOWS)) {
// executable 'Taskkill'
// args '/PID', hdfsCluster.pid, '/F'
// } else {
// executable 'kill'
// args '-9', hdfsCluster.pid
// }
//}
//integTest.dependsOn(miniHdfsStart)
//integTest.finalizedBy(miniHdfsStop)
thirdPartyAudit.enabled = false
artifacts {
archives bundlePlugin
'default' bundlePlugin
}