This commit is contained in:
Phillip Webb
2014-05-20 13:13:39 +01:00
parent e40acd81e4
commit 8bcda1bcbe
91 changed files with 477 additions and 438 deletions

View File

@@ -95,7 +95,8 @@ public abstract class AbstractDependencyFilterMojo extends AbstractMojo {
}
filters.addFilter(new ArtifactIdFilter("",
cleanFilterConfig(this.excludeArtifactIds)));
filters.addFilter(new MatchingGroupIdFilter(cleanFilterConfig(this.excludeGroupIds)));
filters.addFilter(new MatchingGroupIdFilter(
cleanFilterConfig(this.excludeGroupIds)));
if (this.excludes != null) {
filters.addFilter(new ExcludeFilter(this.excludes));
}

View File

@@ -1,3 +1,19 @@
/*
* 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.maven;
import org.apache.maven.artifact.Artifact;
@@ -6,10 +22,11 @@ import org.apache.maven.shared.artifact.filter.collection.AbstractArtifactFeatur
/**
* An {@link org.apache.maven.shared.artifact.filter.collection.ArtifactsFilter
* ArtifactsFilter} that filters by matching groupId.
*
* Preferred over the {@link org.apache.maven.shared.artifact.filter.collection.GroupIdFilter} due
* to that classes use of {@link String#startsWith} to match on prefix.
*
*
* Preferred over the
* {@link org.apache.maven.shared.artifact.filter.collection.GroupIdFilter} due to that
* classes use of {@link String#startsWith} to match on prefix.
*
* @author Mark Ingram
* @since 1.1
*/
@@ -22,7 +39,9 @@ public class MatchingGroupIdFilter extends AbstractArtifactFeatureFilter {
super("", exclude);
}
@Override
protected String getArtifactFeature(Artifact artifact) {
return artifact.getGroupId();
}
}

View File

@@ -33,6 +33,7 @@ import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
/**
* Tests for {@link AbstractDependencyFilterMojo}.
*
* @author Stephane Nicoll
*/
@@ -54,7 +55,7 @@ public class DependencyFilterMojoTests {
@Test
public void filterGroupIdExactMatch() throws MojoExecutionException {
TestableDependencyFilterMojo mojo = new TestableDependencyFilterMojo(
Collections.<Exclude>emptyList(), "com.foo", "");
Collections.<Exclude> emptyList(), "com.foo", "");
Artifact artifact = createArtifact("com.foo.bar", "one");
Set<Artifact> artifacts = mojo.filterDependencies(
@@ -91,5 +92,6 @@ public class DependencyFilterMojoTests {
public void execute() throws MojoExecutionException, MojoFailureException {
}
}
}