From 911e864ce10d81c207443570e31e78be17fc938e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Vonheiden?= <bjoern.vonheiden@hotmail.de>
Date: Thu, 14 May 2020 09:53:34 +0200
Subject: [PATCH] Share dependencies in gradle with all subprojects

---
 build.gradle                        | 40 +++++++++++++++--------------
 uc1-application/build.gradle        |  9 -------
 uc1-workload-generator/build.gradle |  9 -------
 uc2-application/build.gradle        |  9 -------
 uc2-workload-generator/build.gradle |  9 -------
 uc3-application/build.gradle        | 10 --------
 uc3-workload-generator/build.gradle |  9 -------
 uc4-application/build.gradle        | 10 --------
 uc4-workload-generator/build.gradle |  9 -------
 9 files changed, 21 insertions(+), 93 deletions(-)

diff --git a/build.gradle b/build.gradle
index 98b762b74..682786086 100644
--- a/build.gradle
+++ b/build.gradle
@@ -21,11 +21,9 @@ subprojects {
   apply plugin: 'checkstyle'
   apply plugin: 'pmd'
   apply plugin: 'com.github.spotbugs'
+  apply plugin: 'java-library'
 }
 
-// Local plugins
-apply plugin: 'java-library'
-
 // Java version for all subprojects
 subprojects {
   java {
@@ -34,13 +32,12 @@ subprojects {
   }
 }
 
-
+// Check for updates every build
 configurations.all {
-    // Check for updates every build
     resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
 }
 
-//
+// Repositories for all projects
 allprojects {
 	repositories {
 	    jcenter()
@@ -50,20 +47,25 @@ allprojects {
 	}
 }
 
-dependencies {
-    // These dependencies is exported to consumers, that is to say found on their compile classpath.
-    api('org.industrial-devops:titan-ccp-common:0.0.3-SNAPSHOT') { changing = true }
-    api 'net.kieker-monitoring:kieker:1.14-SNAPSHOT'
-    api 'net.sourceforge.teetime:teetime:3.0'
-
-    // These dependencies are used internally, and not exposed to consumers on their own compile classpath.
-    implementation 'org.apache.kafka:kafka-clients:2.1.0'
-    implementation 'com.google.guava:guava:24.1-jre'
-    implementation 'org.jctools:jctools-core:2.1.1'
-
-    // Use JUnit test framework
-    testImplementation 'junit:junit:4.12'
+// Dependencies
+subprojects {
+  dependencies {
+      // These dependencies is exported to consumers, that is to say found on their compile classpath.
+      api('org.industrial-devops:titan-ccp-common:0.0.3-SNAPSHOT') { changing = true }
+      api 'net.kieker-monitoring:kieker:1.14-SNAPSHOT'
+      api 'net.sourceforge.teetime:teetime:3.0'
+
+      // These dependencies are used internally, and not exposed to consumers on their own compile classpath.
+      implementation 'org.apache.kafka:kafka-clients:2.1.0'
+      implementation 'com.google.guava:guava:24.1-jre'
+      implementation 'org.jctools:jctools-core:2.1.1'
+      implementation 'org.slf4j:slf4j-simple:1.6.1'
+
+      // Use JUnit test framework
+      testImplementation 'junit:junit:4.12'
+  }
 }
+
 // Per default XML reports for SpotBugs are generated
 // Include this to generate HTML reports
 tasks.withType(com.github.spotbugs.SpotBugsTask) {
diff --git a/uc1-application/build.gradle b/uc1-application/build.gradle
index 58d193232..f6b2ee26a 100644
--- a/uc1-application/build.gradle
+++ b/uc1-application/build.gradle
@@ -1,10 +1 @@
-dependencies {
-    compile project(':')
-
-    compile 'org.slf4j:slf4j-simple:1.6.1'
-
-    // Use JUnit test framework
-    testCompile 'junit:junit:4.12'
-}
-
 mainClassName = "uc1.application.HistoryService"
diff --git a/uc1-workload-generator/build.gradle b/uc1-workload-generator/build.gradle
index 4ac401e5f..0663dcd33 100644
--- a/uc1-workload-generator/build.gradle
+++ b/uc1-workload-generator/build.gradle
@@ -1,10 +1 @@
-dependencies {
-    compile project(':')
-
-    compile 'org.slf4j:slf4j-simple:1.6.1'
-
-    // Use JUnit test framework
-    testCompile 'junit:junit:4.12'
-}
-
 mainClassName = "uc1.workloadGenerator.LoadGenerator"
diff --git a/uc2-application/build.gradle b/uc2-application/build.gradle
index e4161983a..5ef5e63a0 100644
--- a/uc2-application/build.gradle
+++ b/uc2-application/build.gradle
@@ -1,10 +1 @@
-dependencies {
-    compile project(':')
-
-    compile 'org.slf4j:slf4j-simple:1.6.1'
-
-    // Use JUnit test framework
-    testCompile 'junit:junit:4.12'
-}
-
 mainClassName = "uc2.application.AggregationService"
diff --git a/uc2-workload-generator/build.gradle b/uc2-workload-generator/build.gradle
index a59af4ae0..bb4f4a0ca 100644
--- a/uc2-workload-generator/build.gradle
+++ b/uc2-workload-generator/build.gradle
@@ -1,10 +1 @@
-dependencies {
-    compile project(':')
-
-    compile 'org.slf4j:slf4j-simple:1.6.1'
-
-    // Use JUnit test framework
-    testCompile 'junit:junit:4.12'
-}
-
 mainClassName = "uc2.workloadGenerator.LoadGenerator"
diff --git a/uc3-application/build.gradle b/uc3-application/build.gradle
index 8be200135..343619a6a 100644
--- a/uc3-application/build.gradle
+++ b/uc3-application/build.gradle
@@ -1,9 +1,5 @@
 allprojects {
 	repositories {
-	    jcenter()
-	    maven {
-	    	url "https://oss.sonatype.org/content/repositories/snapshots/"
-	    }
     	maven {
     		url 'https://packages.confluent.io/maven/'
     	}
@@ -11,13 +7,7 @@ allprojects {
 }
 
 dependencies {
-    compile project(':')
-
     compile('org.industrial-devops:titan-ccp-common-kafka:0.1.0-SNAPSHOT')
-    compile 'org.slf4j:slf4j-simple:1.6.1'
-
-    // Use JUnit test framework
-    testCompile 'junit:junit:4.12'
 }
 
 mainClassName = "uc3.application.HistoryService"
diff --git a/uc3-workload-generator/build.gradle b/uc3-workload-generator/build.gradle
index 87c407334..f1019cd12 100644
--- a/uc3-workload-generator/build.gradle
+++ b/uc3-workload-generator/build.gradle
@@ -1,10 +1 @@
-dependencies {
-    compile project(':')
-
-    compile 'org.slf4j:slf4j-simple:1.6.1'
-
-    // Use JUnit test framework
-    testCompile 'junit:junit:4.12'
-}
-
 mainClassName = "uc3.workloadGenerator.LoadGenerator"
diff --git a/uc4-application/build.gradle b/uc4-application/build.gradle
index b214dac46..ce402c3cc 100644
--- a/uc4-application/build.gradle
+++ b/uc4-application/build.gradle
@@ -1,9 +1,5 @@
 allprojects {
 	repositories {
-	    jcenter()
-	    maven {
-	    	url "https://oss.sonatype.org/content/repositories/snapshots/"
-	    }
     	maven {
     		url 'https://packages.confluent.io/maven/'
     	}
@@ -11,13 +7,7 @@ allprojects {
 }
 
 dependencies {
-    compile project(':')
-
-    compile 'org.slf4j:slf4j-simple:1.6.1'
     compile('org.industrial-devops:titan-ccp-common-kafka:0.1.0-SNAPSHOT')
-
-    // Use JUnit test framework
-    testCompile 'junit:junit:4.12'
 }
 
 mainClassName = "uc4.application.HistoryService"
diff --git a/uc4-workload-generator/build.gradle b/uc4-workload-generator/build.gradle
index f2d0178cc..9d61f82a8 100644
--- a/uc4-workload-generator/build.gradle
+++ b/uc4-workload-generator/build.gradle
@@ -1,10 +1 @@
-dependencies {
-    compile project(':')
-
-    compile 'org.slf4j:slf4j-simple:1.6.1'
-
-    // Use JUnit test framework
-    testCompile 'junit:junit:4.12'
-}
-
 mainClassName = "uc4.workloadGenerator.LoadGenerator"
-- 
GitLab