Exact match for groupId excludes
Previous to this commit, any groupId starting with one of the configured exclude would be excluded as well. This potentially leads to unintentional dependency filtering: for example the GroupIdFilter with an exclusion of "org.springframework" also removes "org.springframework.boot" dependencies. Add MatchingGroupIdFilter that uses an exact match instead. See #649pull/890/merge
parent
77ae790363
commit
dd83b58b05
@ -0,0 +1,28 @@
|
||||
package org.springframework.boot.maven;
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.shared.artifact.filter.collection.AbstractArtifactFeatureFilter;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @author Mark Ingram
|
||||
* @since 1.1
|
||||
*/
|
||||
public class MatchingGroupIdFilter extends AbstractArtifactFeatureFilter {
|
||||
|
||||
/**
|
||||
* Create a new instance with the CSV groupId values that should be excluded.
|
||||
*/
|
||||
public MatchingGroupIdFilter(String exclude) {
|
||||
super("", exclude);
|
||||
}
|
||||
|
||||
protected String getArtifactFeature(Artifact artifact) {
|
||||
return artifact.getGroupId();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue