Hash :
32119823
Author :
Date :
2022-04-29T19:31:07
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
<h2>Full example</h2>
<pre><code>apply plugin: "java"
apply plugin: "eclipse"
apply plugin: "idea"
group = "com.mycompany.hadoopproject"
version = "1.0"
repositories {
// Standard Maven
mavenCentral()
maven {
url "https://repository.cloudera.com/artifactory/cloudera-repos/"
}
}
// Mimic Maven 'provided' configuration, as suggested in GRADLE-784
configurations {
provided
}
sourceSets {
main {
compileClasspath += configurations.provided
}
}
ext.hadoopVersion = "2.0.0-mr1-cdh4.0.1"
dependencies {
provided "org.apache.hadoop:hadoop-client:${hadoopVersion}"
// Example of adding a specific compile time dependency
compile "com.google.guava:guava:11.0.2"
testCompile "junit:junit:4.8.2"
}
// Java version selection
sourceCompatibility = 1.6
targetCompatibility = 1.6
eclipse {
classpath {
// Ensure Eclipse build output appears in build directory
defaultOutputDir = file("${buildDir}/eclipse-classes")
// Ensure the provided configuration jars are available in Eclipse
plusConfigurations += configurations.provided
}
}
// Emulate Maven shade plugin with a fat jar.
// http://docs.codehaus.org/display/GRADLE/Cookbook#Cookbook-Creatingafatjar
jar {
from configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}</code></pre>