github.com/apache/beam/sdks/v2@v2.48.2/java/io/hadoop-file-system/build.gradle (about) 1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * License); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an AS IS BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19 import java.util.stream.Collectors 20 21 plugins { id 'org.apache.beam.module' } 22 applyJavaNature( 23 automaticModuleName: 'org.apache.beam.sdk.io.hdfs') 24 25 description = "Apache Beam :: SDKs :: Java :: IO :: Hadoop File System" 26 ext.summary = "Library to read and write Hadoop/HDFS file formats from Beam." 27 28 def hadoopVersions = [ 29 "285": "2.8.5", 30 "292": "2.9.2", 31 "2102": "2.10.2", 32 "324": "3.2.4", 33 ] 34 35 hadoopVersions.each {kv -> configurations.create("hadoopVersion$kv.key")} 36 37 dependencies { 38 implementation library.java.vendored_guava_26_0_jre 39 implementation project(path: ":sdks:java:core", configuration: "shadow") 40 implementation library.java.jackson_core 41 implementation library.java.jackson_databind 42 implementation library.java.slf4j_api 43 compileOnly library.java.hadoop_client 44 permitUnusedDeclared library.java.hadoop_client 45 compileOnly library.java.hadoop_common 46 compileOnly library.java.hadoop_mapreduce_client_core 47 permitUnusedDeclared library.java.hadoop_mapreduce_client_core 48 testImplementation project(path: ":sdks:java:core", configuration: "shadowTest") 49 testImplementation library.java.mockito_core 50 testImplementation library.java.junit 51 testImplementation library.java.hadoop_minicluster 52 testImplementation library.java.hadoop_hdfs_tests 53 testRuntimeOnly library.java.slf4j_jdk14 54 testRuntimeOnly project(path: ":runners:direct-java", configuration: "shadow") 55 hadoopVersions.each {kv -> 56 "hadoopVersion$kv.key" "org.apache.hadoop:hadoop-client:$kv.value" 57 "hadoopVersion$kv.key" "org.apache.hadoop:hadoop-common:$kv.value" 58 "hadoopVersion$kv.key" "org.apache.hadoop:hadoop-mapreduce-client-core:$kv.value" 59 "hadoopVersion$kv.key" "org.apache.hadoop:hadoop-minicluster:$kv.value" 60 "hadoopVersion$kv.key" "org.apache.hadoop:hadoop-hdfs:$kv.value:tests" 61 "hadoopVersion$kv.key" library.java.slf4j_jdk14 62 } 63 } 64 65 hadoopVersions.each {kv -> 66 configurations."hadoopVersion$kv.key" { 67 resolutionStrategy { 68 force "org.apache.hadoop:hadoop-client:$kv.value" 69 force "org.apache.hadoop:hadoop-common:$kv.value" 70 force "org.apache.hadoop:hadoop-mapreduce-client-core:$kv.value" 71 force "org.apache.hadoop:hadoop-minicluster:$kv.value" 72 force "org.apache.hadoop:hadoop-hdfs:$kv.value:tests" 73 force "org.apache.hadoop:hadoop-hdfs-client:$kv.value:tests" 74 force library.java.slf4j_jdk14 75 } 76 } 77 } 78 79 // Hadoop dependencies require old version of Guava (BEAM-11626) 80 configurations.all (Configuration it) -> { 81 // error-prone requires newer guava, don't override for annotation processing 82 // https://github.com/google/error-prone/issues/2745 83 if (it.name == "annotationProcessor" || it.name =="testAnnotationProcessor") { 84 return 85 } 86 resolutionStrategy { 87 force 'com.google.guava:guava:25.1-jre' 88 } 89 } 90 91 task hadoopVersionsTest(group: "Verification") { 92 description = "Runs Hadoop file system tests with different Hadoop versions" 93 def taskNames = hadoopVersions.keySet().stream() 94 .map{num -> "hadoopVersion${num}Test"} 95 .collect(Collectors.toList()) 96 dependsOn taskNames 97 } 98 99 hadoopVersions.each { kv -> 100 task "hadoopVersion${kv.key}Test"(type: Test, group: "Verification") { 101 description = "Runs Hadoop file system tests with Hadoop version $kv.value" 102 classpath = configurations."hadoopVersion$kv.key" + sourceSets.test.runtimeClasspath 103 outputs.upToDateWhen { false } 104 include '**/*Test.class' 105 } 106 }