You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by vo...@apache.org on 2020/05/03 17:52:24 UTC

[fineract] 02/03: exclude dependencies causing classpath duplicates (FINERACT-919)

This is an automated email from the ASF dual-hosted git repository.

vorburger pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git

commit 83cdb17d8f46288b0a53ab84f64ae080c1f7362c
Author: Michael Vorburger <mi...@vorburger.ch>
AuthorDate: Sun May 3 02:25:54 2020 +0200

    exclude dependencies causing classpath duplicates (FINERACT-919)
---
 fineract-provider/build.gradle                     |  1 -
 fineract-provider/dependencies.gradle              | 48 +++++++++++++---------
 .../integrationtests/common/CenterHelper.java      | 20 +++++----
 .../integrationtests/common/GroupHelper.java       |  6 +--
 .../classdupes/ClasspathHellDuplicatesChecker.java | 13 +++++-
 5 files changed, 54 insertions(+), 34 deletions(-)

diff --git a/fineract-provider/build.gradle b/fineract-provider/build.gradle
index 30393de..0293682 100644
--- a/fineract-provider/build.gradle
+++ b/fineract-provider/build.gradle
@@ -102,7 +102,6 @@ dependencyManagement {
         dependency 'io.swagger:swagger-jersey-jaxrs:1.5.15'
         dependency 'org.springframework:spring-jms:4.0.7.RELEASE'
         dependency 'org.apache.activemq:activemq-broker:+'
-        dependency 'javax.validation:validation-api:+'
         dependency 'org.apache.bval:org.apache.bval.bundle:2.0.2'
         dependencySet(group: 'io.rest-assured', version: '3.3.0'){
             entry 'rest-assured'
diff --git a/fineract-provider/dependencies.gradle b/fineract-provider/dependencies.gradle
index e701658..e653ea7 100644
--- a/fineract-provider/dependencies.gradle
+++ b/fineract-provider/dependencies.gradle
@@ -23,16 +23,16 @@ dependencies {
             exclude group: 'org.eclipse.jdt.core.compiler', module: 'ecj'
         }
 
-    providedRuntime("org.springframework.boot:spring-boot-starter-tomcat")
+    providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')
 
-    spotbugsPlugins "jp.skypencil.findbugs.slf4j:bug-pattern:1.4.2@jar"
+    spotbugsPlugins 'jp.skypencil.findbugs.slf4j:bug-pattern:1.4.2@jar'
 
-    compile ("org.springframework.boot:spring-boot-starter-data-jpa")
+    compile ('org.springframework.boot:spring-boot-starter-data-jpa') {
+		exclude group: 'org.hibernate'
+    }
 
     api(
             'com.google.code.gson:gson',
-            'org.quartz-scheduler:quartz',
-            'org.apache.openjpa:openjpa',
             'org.springframework:spring-jms',
             'joda-time:joda-time',
             'org.mnode.ical4j:ical4j',
@@ -42,6 +42,14 @@ dependencies {
             'com.sun.jersey:jersey-core',
             'com.squareup.retrofit:retrofit'
     )
+	api ('org.apache.openjpa:openjpa') {
+		exclude group: 'org.eclipse.persistence'
+		exclude group: 'org.apache.geronimo.specs'
+	}
+	api('org.quartz-scheduler:quartz') {
+		exclude group: 'com.zaxxer', module: 'HikariCP-java7'
+	}
+
     implementation(
             //'ch.vorburger.mariaDB4j:mariaDB4j:2.4.0',
 
@@ -51,10 +59,8 @@ dependencies {
 
             //'org.eclipse.persistence:javax.persistence',
 
-
             'org.springframework.security.oauth:spring-security-oauth2',
 
-
             //'javax.ws.rs:jsr311-api',
 
             'com.sun.jersey:jersey-servlet',
@@ -96,20 +102,17 @@ dependencies {
             // Once we've switched to Java 8 this dep can be removed.
             //'com.google.code.findbugs:jsr305',
 
-            'io.swagger:swagger-jersey-jaxrs',
             'org.apache.activemq:activemq-broker',
-            'javax.validation:validation-api',
+            'org.apache.bval:org.apache.bval.bundle'
     )
+    implementation ('io.swagger:swagger-jersey-jaxrs') {
+		exclude group: 'javax.validation'
+    }
 
-    implementation 'org.apache.bval:org.apache.bval.bundle'
-
-    testCompile 'io.rest-assured:rest-assured',
-            'junit:junit',
+    testCompile 'junit:junit',
             //'junit:junit-dep',
             'org.mockito:mockito-core',
             'io.github.classgraph:classgraph:4.8.43',
-            'org.slf4j:slf4j-simple',
-            'com.mockrunner:mockrunner-jms',
             'com.google.code.gson:gson',
             'org.springframework:spring-jms',
             'joda-time:joda-time',
@@ -117,10 +120,17 @@ dependencies {
             'com.google.guava:guava',
             'org.apache.poi:poi-ooxml',
             'org.springframework:spring-context-support',
-            'com.sun.jersey:jersey-core',
-            'com.mockrunner:mockrunner-jdbc'
-
-    testCompile ("org.springframework.boot:spring-boot-starter-test") {
+            'com.sun.jersey:jersey-core'
+	testCompile ('com.mockrunner:mockrunner-jdbc' ) {
+        exclude group: 'regexp'
+    }
+    testCompile ('com.mockrunner:mockrunner-jms') {
+        exclude group: 'regexp'
+    }
+    testCompile ('io.rest-assured:rest-assured') {
+        exclude group: 'org.apache.sling'
+    }
+    testCompile ('org.springframework.boot:spring-boot-starter-test') {
         exclude group: 'com.jayway.jsonpath', module: 'json-path'
     }
 }
diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/CenterHelper.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/CenterHelper.java
index 9b415e1..0dd2586 100644
--- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/CenterHelper.java
+++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/CenterHelper.java
@@ -20,13 +20,13 @@ package org.apache.fineract.integrationtests.common;
 
 import static org.junit.Assert.assertEquals;
 
+import com.google.common.base.Strings;
 import com.google.common.reflect.TypeToken;
 import com.google.gson.Gson;
 import io.restassured.specification.RequestSpecification;
 import io.restassured.specification.ResponseSpecification;
 import java.util.ArrayList;
 import java.util.HashMap;
-import org.apache.commons.lang3.StringUtils;
 
 @SuppressWarnings({ "rawtypes", "unchecked" })
 public class CenterHelper {
@@ -85,9 +85,15 @@ public class CenterHelper {
         hm.put("officeId", officeId);
         hm.put("active", false);
 
-        if (externalId != null) hm.put("externalId", externalId);
-        if (staffId != -1) hm.put("staffId", staffId);
-        if (groupMembers != null) hm.put("groupMembers", groupMembers);
+        if (externalId != null) {
+            hm.put("externalId", externalId);
+        }
+        if (staffId != -1) {
+            hm.put("staffId", staffId);
+        }
+        if (groupMembers != null) {
+            hm.put("groupMembers", groupMembers);
+        }
         if (activationDate != null) {
             hm.put("active", true);
             hm.put("locale", "en");
@@ -235,7 +241,7 @@ public class CenterHelper {
         final HashMap<String, String> map = new HashMap<>();
         map.put("dateFormat", "dd MMMM yyyy");
         map.put("locale", "en");
-        if (StringUtils.isNotEmpty(activationDate)) {
+        if (!Strings.isNullOrEmpty(activationDate)) {
             map.put("activationDate", activationDate);
         } else {
             map.put("activationDate", "CREATED_DATE");
@@ -249,10 +255,6 @@ public class CenterHelper {
         return Utils.randomStringGenerator(prefix, lenOfRandomSuffix);
     }
 
-    private static String randomIDGenerator(final String prefix, final int lenOfRandomSuffix) {
-        return Utils.randomStringGenerator(prefix, lenOfRandomSuffix, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
-    }
-
     public static Object assignStaff(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
             final String groupId, final Long staffId) {
         final String GROUP_ASSIGN_STAFF_URL = "/fineract-provider/api/v1/groups/" + groupId + "?" + Utils.TENANT_IDENTIFIER
diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/GroupHelper.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/GroupHelper.java
index 255540d..b092006 100755
--- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/GroupHelper.java
+++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/GroupHelper.java
@@ -22,13 +22,13 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
+import com.google.common.base.Strings;
 import com.google.gson.Gson;
 import io.restassured.specification.RequestSpecification;
 import io.restassured.specification.ResponseSpecification;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
-import org.apache.commons.lang3.StringUtils;
 
 public class GroupHelper {
 
@@ -144,7 +144,7 @@ public class GroupHelper {
     }
 
     public static String associateClientAsJSON(final String clientMember) {
-        final HashMap<String, List<String>> map = new HashMap<String, List<String>>();
+        final HashMap<String, List<String>> map = new HashMap<>();
         final List<String> list = new ArrayList<>();
         list.add(clientMember);
         map.put("clientMembers", list);
@@ -156,7 +156,7 @@ public class GroupHelper {
         final HashMap<String, String> map = new HashMap<>();
         map.put("dateFormat", "dd MMMM yyyy");
         map.put("locale", "en");
-        if (StringUtils.isNotEmpty(activationDate)) {
+        if (!Strings.isNullOrEmpty(activationDate)) {
             map.put("activationDate", activationDate);
         } else {
             map.put("activationDate", "04 March 2011");
diff --git a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/classdupes/ClasspathHellDuplicatesChecker.java b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/classdupes/ClasspathHellDuplicatesChecker.java
index d25ed42..01eaa73 100644
--- a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/classdupes/ClasspathHellDuplicatesChecker.java
+++ b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/classdupes/ClasspathHellDuplicatesChecker.java
@@ -87,7 +87,8 @@ public class ClasspathHellDuplicatesChecker {
 
     private boolean skipJAR(String jarPath) {
         // ./gradlew test finds classes from the Gradle Wrapper (which don't show up in-IDE), exclude those
-        return jarPath.contains("/.gradle/wrapper/dists/");
+        return jarPath.contains("/.gradle/wrapper/dists/")
+                || jarPath.contains("/io.rest-assured/");  // TODO FINERACT-884 remove when RestAssured was bumped from 3.3.0 to 4.3.0 in Spring BOM
     }
 
     protected boolean isHarmlessDuplicate(String resourcePath) {
@@ -95,6 +96,7 @@ public class ClasspathHellDuplicatesChecker {
         return resourcePath.equals("META-INF/MANIFEST.MF")
                 || resourcePath.equals("META-INF/INDEX.LIST")
                 || resourcePath.equals("META-INF/ORACLE_J.SF")
+                || resourcePath.toUpperCase().startsWith("META-INF/ASL")
                 || resourcePath.toUpperCase().startsWith("META-INF/NOTICE")
                 || resourcePath.toUpperCase().startsWith("META-INF/LICENSE")
                 || resourcePath.toUpperCase().startsWith("LICENSE")
@@ -112,8 +114,9 @@ public class ClasspathHellDuplicatesChecker {
                 || resourcePath.equals("META-INF/jersey-module-version")
                 || resourcePath.startsWith("OSGI-INF/blueprint/")
                 || resourcePath.startsWith("org/opendaylight/blueprint/")
-                || resourcePath.equals("WEB-INF/web.xml")
                 || resourcePath.endsWith("reference.conf") // in Akka's JARs
+                || resourcePath.equals("WEB-INF/web.xml")
+                || resourcePath.equals("META-INF/web-fragment.xml")
                 || resourcePath.equals("META-INF/eclipse.inf")
                 || resourcePath.equals("META-INF/ECLIPSE_.SF")
                 || resourcePath.equals("META-INF/ECLIPSE_.RSA")
@@ -121,6 +124,12 @@ public class ClasspathHellDuplicatesChecker {
                 || resourcePath.equals("META-INF/BC2048KE.SF")
                 || resourcePath.equals("META-INF/BC1024KE.SF")
                 || resourcePath.equals("OSGI-INF/bundle.info")
+                // Spring Framework knows what they are do..
+                || resourcePath.startsWith("META-INF/spring")
+                || resourcePath.startsWith("META-INF/additional-spring")
+                || resourcePath.startsWith("META-INF/terracotta")
+                // Groovy is groovy
+                || resourcePath.startsWith("META-INF/groovy-release-info.properties")
                 // Something doesn't to be a perfectly clean in Maven Surefire:
                 || resourcePath.startsWith("META-INF/maven/")
                 || resourcePath.contains("surefire")