github.com/apache/beam/sdks/v2@v2.48.2/java/io/hadoop-common/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( automaticModuleName: 'org.apache.beam.sdk.io.hadoop.common') 23 24 description = "Apache Beam :: SDKs :: Java :: IO :: Hadoop Common" 25 ext.summary = "Library to add shared Hadoop classes among Beam IOs." 26 27 def hadoopVersions = [ 28 "285": "2.8.5", 29 "292": "2.9.2", 30 "2102": "2.10.2", 31 "324": "3.2.4", 32 ] 33 34 hadoopVersions.each {kv -> configurations.create("hadoopVersion$kv.key")} 35 36 dependencies { 37 implementation project(path: ":sdks:java:core", configuration: "shadow") 38 provided library.java.hadoop_client 39 permitUnusedDeclared library.java.hadoop_client 40 provided library.java.hadoop_common 41 provided library.java.hadoop_mapreduce_client_core 42 testImplementation library.java.junit 43 testImplementation library.java.hadoop_common 44 testImplementation library.java.hadoop_mapreduce_client_core 45 testImplementation library.java.hamcrest 46 hadoopVersions.each {kv -> 47 "hadoopVersion$kv.key" "org.apache.hadoop:hadoop-client:$kv.value" 48 "hadoopVersion$kv.key" "org.apache.hadoop:hadoop-common:$kv.value" 49 "hadoopVersion$kv.key" "org.apache.hadoop:hadoop-mapreduce-client-core:$kv.value" 50 } 51 } 52 53 hadoopVersions.each {kv -> 54 configurations."hadoopVersion$kv.key" { 55 resolutionStrategy { 56 force "org.apache.hadoop:hadoop-client:$kv.value" 57 force "org.apache.hadoop:hadoop-common:$kv.value" 58 force "org.apache.hadoop:hadoop-mapreduce-client-core:$kv.value" 59 } 60 } 61 } 62 63 task hadoopVersionsTest(group: "Verification") { 64 description = "Runs Hadoop common tests with different Hadoop versions" 65 def taskNames = hadoopVersions.keySet().stream() 66 .map{num -> "hadoopVersion${num}Test"} 67 .collect(Collectors.toList()) 68 dependsOn taskNames 69 } 70 71 hadoopVersions.each { kv -> 72 task "hadoopVersion${kv.key}Test"(type: Test, group: "Verification") { 73 description = "Runs Hadoop common tests with Hadoop version $kv.value" 74 classpath = configurations."hadoopVersion$kv.key" + sourceSets.test.runtimeClasspath 75 include '**/*Test.class' 76 } 77 }