|
|
|
@ -16,6 +16,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
package org.springframework.boot.build.classpath; |
|
|
|
package org.springframework.boot.build.classpath; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.Set; |
|
|
|
import java.util.TreeSet; |
|
|
|
import java.util.TreeSet; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
@ -35,6 +36,11 @@ import org.gradle.api.tasks.TaskAction; |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class CheckClasspathForProhibitedDependencies extends DefaultTask { |
|
|
|
public class CheckClasspathForProhibitedDependencies extends DefaultTask { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static final Set<String> PROHIBITED_GROUPS = Set.of("org.codehaus.groovy", "org.eclipse.jetty.toolchain", |
|
|
|
|
|
|
|
"commons-logging", "org.apache.geronimo.specs", "com.sun.activation"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static final Set<String> PERMITTED_JAVAX_GROUPS = Set.of("javax.batch", "javax.cache", "javax.money"); |
|
|
|
|
|
|
|
|
|
|
|
private Configuration classpath; |
|
|
|
private Configuration classpath; |
|
|
|
|
|
|
|
|
|
|
|
public CheckClasspathForProhibitedDependencies() { |
|
|
|
public CheckClasspathForProhibitedDependencies() { |
|
|
|
@ -69,29 +75,20 @@ public class CheckClasspathForProhibitedDependencies extends DefaultTask { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private boolean prohibited(ModuleVersionIdentifier id) { |
|
|
|
private boolean prohibited(ModuleVersionIdentifier id) { |
|
|
|
String group = id.getGroup(); |
|
|
|
return PROHIBITED_GROUPS.contains(id.getGroup()) || prohibitedJavax(id) || prohibitedSlf4j(id) |
|
|
|
switch (group) { |
|
|
|
|| prohibitedJbossSpec(id); |
|
|
|
case "javax.batch", "javax.cache", "javax.money" -> { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
case "commons-logging", "org.codehaus.groovy", "org.eclipse.jetty.toolchain", |
|
|
|
|
|
|
|
"org.apache.geronimo.specs" -> { |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (group.startsWith("javax")) { |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if (group.equals("org.slf4j") && id.getName().equals("jcl-over-slf4j")) { |
|
|
|
|
|
|
|
return true; |
|
|
|
private boolean prohibitedSlf4j(ModuleVersionIdentifier id) { |
|
|
|
} |
|
|
|
return id.getGroup().equals("org.slf4j") && id.getName().equals("jcl-over-slf4j"); |
|
|
|
if (group.startsWith("org.jboss.spec")) { |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if (group.equals("org.apache.geronimo.specs")) { |
|
|
|
|
|
|
|
return true; |
|
|
|
private boolean prohibitedJbossSpec(ModuleVersionIdentifier id) { |
|
|
|
|
|
|
|
return id.getGroup().startsWith("org.jboss.spec"); |
|
|
|
} |
|
|
|
} |
|
|
|
return group.equals("com.sun.activation"); |
|
|
|
|
|
|
|
|
|
|
|
private boolean prohibitedJavax(ModuleVersionIdentifier id) { |
|
|
|
|
|
|
|
return id.getGroup().startsWith("javax.") && !PERMITTED_JAVAX_GROUPS.contains(id.getGroup()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|