Implement simpler exclusion logic for Gradle

Simplify the exclusion logic used in Gradle by implementing implicit
exclusions rather than trying to detect transitive excludes.

This commit reverts much of the code originally included to fix gh-1047
which adds far too much complexity to the build and still doesn't solve
the underlying issue.

Fixes gh-1103
This commit is contained in:
Phillip Webb
2014-06-16 16:09:02 -07:00
parent f83c6aa7c1
commit 3a8a127285
21 changed files with 38 additions and 1882 deletions

View File

@@ -1,50 +0,0 @@
/*
* Copyright 2012-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.dependency.tools;
import org.junit.Test;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;
/**
* Tests for {@link DependenciesWithTransitiveExclusions}.
*
* @author Phillip Webb
*/
public class DependenciesWithTransitiveExclusionsTests {
@Test
public void findsTransitiveExclusions() throws Exception {
Dependencies source = new PomDependencies(getClass().getResourceAsStream(
"test-effective-pom.xml"));
DependencyTree tree = new DependencyTree(getClass().getResourceAsStream(
"test-effective-pom-dependency-tree.txt"));
DependenciesWithTransitiveExclusions dependencies = new DependenciesWithTransitiveExclusions(
source, tree);
assertExcludes(dependencies, "sample01", "[org.exclude:exclude01]");
assertExcludes(source, "sample02", "[]");
assertExcludes(dependencies, "sample02", "[org.exclude:exclude01]");
}
private void assertExcludes(Dependencies dependencies, String artifactId,
String expected) {
Dependency dependency = dependencies.find("org.sample", artifactId);
assertThat(dependency.getExclusions().toString(), equalTo(expected));
}
}

View File

@@ -1,44 +0,0 @@
/*
* Copyright 2012-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.dependency.tools;
import org.junit.Test;
import org.springframework.boot.dependency.tools.DependencyTree;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;
/**
* Tests for {@link DependencyTree}.
*
* @author Phillip Webb
*/
public class DependencyTreeTests {
@Test
public void parse() throws Exception {
DependencyTree tree = new DependencyTree(getClass().getResourceAsStream(
"sample-dependency-tree.txt"));
assertThat(tree.getRoot().toString(), equalTo("org.springframework.boot:"
+ "spring-boot-versions-dependency-tree:1.1.0.BUILD-SNAPSHOT"));
assertThat(tree.getDependencies().size(), equalTo(204));
assertThat(tree.get(0, 1).toString(), equalTo("org.slf4j:slf4j-api:1.7.6"));
assertThat(tree.get(203).toString(), equalTo("org.springframework.security:"
+ "spring-security-web:3.2.4.RELEASE"));
}
}

View File

@@ -1,5 +0,0 @@
org.sample:sample:pom:1.0.0.BUILD-SNAPSHOT
+- org.sample:sample01:jar:1.0.0:compile
+- org.sample:sample02:jar:1.0.0:compile
| +- (org.sample:sample01:jar:1.0.0:compile - omitted for duplicate)
\- org.springframework.boot:spring-boot:jar:1.0.0.BUILD-SNAPSHOT:compile

View File

@@ -2,8 +2,6 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.sample</groupId>
<artifactId>sample</artifactId>
<version>1.0.0.BUILD-SNAPSHOT</version>
<properties>
<sample.version>1.0.0</sample.version>