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