diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractDependencyFilterMojo.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractDependencyFilterMojo.java index 8fdfff237c1..4cb43097b3f 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractDependencyFilterMojo.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractDependencyFilterMojo.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -26,7 +26,6 @@ import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.shared.artifact.filter.collection.ArtifactFilterException; -import org.apache.maven.shared.artifact.filter.collection.ArtifactIdFilter; import org.apache.maven.shared.artifact.filter.collection.ArtifactsFilter; import org.apache.maven.shared.artifact.filter.collection.FilterArtifacts; @@ -64,13 +63,6 @@ public abstract class AbstractDependencyFilterMojo extends AbstractMojo { @Parameter(property = "spring-boot.excludeGroupIds", defaultValue = "") private String excludeGroupIds; - /** - * Comma separated list of artifact names to exclude (exact match). - * @since 1.1 - */ - @Parameter(property = "spring-boot.excludeArtifactIds", defaultValue = "") - private String excludeArtifactIds; - protected void setExcludes(List excludes) { this.excludes = excludes; } @@ -83,10 +75,6 @@ public abstract class AbstractDependencyFilterMojo extends AbstractMojo { this.excludeGroupIds = excludeGroupIds; } - protected void setExcludeArtifactIds(String excludeArtifactIds) { - this.excludeArtifactIds = excludeArtifactIds; - } - protected Set filterDependencies(Set dependencies, FilterArtifacts filters) throws MojoExecutionException { try { @@ -109,8 +97,6 @@ public abstract class AbstractDependencyFilterMojo extends AbstractMojo { for (ArtifactsFilter additionalFilter : additionalFilters) { filters.addFilter(additionalFilter); } - filters.addFilter( - new ArtifactIdFilter("", cleanFilterConfig(this.excludeArtifactIds))); filters.addFilter( new MatchingGroupIdFilter(cleanFilterConfig(this.excludeGroupIds))); if (this.includes != null && !this.includes.isEmpty()) { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/exclude-dependency.apt.vm b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/exclude-dependency.apt.vm index b3f339449f0..a9928369914 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/exclude-dependency.apt.vm +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/exclude-dependency.apt.vm @@ -15,13 +15,11 @@ executable jar. For consistency, they should not be present either when running the application. - There are three ways one can exclude a dependency from being packaged/used at runtime + There are two ways one can exclude a dependency from being packaged/used at runtime * Exclude a specific artifact identified by <<>> and <<>> (optionally with a <<>> if needed) - * Exclude any artifact matching a given <<>> - * Exclude any artifact belonging to a given <<>> [] @@ -57,34 +55,7 @@ --- - This example excludes any artifacts having the <<>> or <<>> - artifact identifiers - ---- - - ... - - ... - - ... - - ${project.groupId} - ${project.artifactId} - ${project.version} - - my-lib,another-lib - - ... - - ... - - ... - - ... - ---- - - Finally this example excludes any artifact belonging to the <<>> group + This example excludes any artifact belonging to the <<>> group --- diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/DependencyFilterMojoTests.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/DependencyFilterMojoTests.java index c198ef87ee7..242da7e8f92 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/DependencyFilterMojoTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/DependencyFilterMojoTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -42,12 +42,12 @@ public class DependencyFilterMojoTests { @Test public void filterDependencies() throws MojoExecutionException { TestableDependencyFilterMojo mojo = new TestableDependencyFilterMojo( - Collections.emptyList(), "com.foo", "exclude-id"); + Collections.emptyList(), "com.foo"); Artifact artifact = createArtifact("com.bar", "one"); Set artifacts = mojo.filterDependencies( createArtifact("com.foo", "one"), createArtifact("com.foo", "two"), - createArtifact("com.bar", "exclude-id"), artifact); + artifact); assertThat(artifacts).hasSize(1); assertThat(artifacts.iterator().next()).isSameAs(artifact); } @@ -55,7 +55,7 @@ public class DependencyFilterMojoTests { @Test public void filterGroupIdExactMatch() throws MojoExecutionException { TestableDependencyFilterMojo mojo = new TestableDependencyFilterMojo( - Collections.emptyList(), "com.foo", ""); + Collections.emptyList(), "com.foo"); Artifact artifact = createArtifact("com.foo.bar", "one"); Set artifacts = mojo.filterDependencies( @@ -68,7 +68,7 @@ public class DependencyFilterMojoTests { @Test public void filterScopeKeepOrder() throws MojoExecutionException { TestableDependencyFilterMojo mojo = new TestableDependencyFilterMojo( - Collections.emptyList(), "", "", + Collections.emptyList(), "", new ScopeFilter(null, Artifact.SCOPE_SYSTEM)); Artifact one = createArtifact("com.foo", "one"); Artifact two = createArtifact("com.foo", "two", Artifact.SCOPE_SYSTEM); @@ -77,22 +77,10 @@ public class DependencyFilterMojoTests { assertThat(artifacts).containsExactly(one, three); } - @Test - public void filterArtifactIdKeepOrder() throws MojoExecutionException { - TestableDependencyFilterMojo mojo = new TestableDependencyFilterMojo( - Collections.emptyList(), "", "one,three"); - Artifact one = createArtifact("com.foo", "one"); - Artifact two = createArtifact("com.foo", "two"); - Artifact three = createArtifact("com.foo", "three"); - Artifact four = createArtifact("com.foo", "four"); - Set artifacts = mojo.filterDependencies(one, two, three, four); - assertThat(artifacts).containsExactly(two, four); - } - @Test public void filterGroupIdKeepOrder() throws MojoExecutionException { TestableDependencyFilterMojo mojo = new TestableDependencyFilterMojo( - Collections.emptyList(), "com.foo", ""); + Collections.emptyList(), "com.foo"); Artifact one = createArtifact("com.foo", "one"); Artifact two = createArtifact("com.bar", "two"); Artifact three = createArtifact("com.bar", "three"); @@ -107,7 +95,7 @@ public class DependencyFilterMojoTests { exclude.setGroupId("com.bar"); exclude.setArtifactId("two"); TestableDependencyFilterMojo mojo = new TestableDependencyFilterMojo( - Collections.singletonList(exclude), "", ""); + Collections.singletonList(exclude), ""); Artifact one = createArtifact("com.foo", "one"); Artifact two = createArtifact("com.bar", "two"); Artifact three = createArtifact("com.bar", "three"); @@ -137,11 +125,9 @@ public class DependencyFilterMojoTests { private final ArtifactsFilter[] additionalFilters; private TestableDependencyFilterMojo(List excludes, - String excludeGroupIds, String excludeArtifactIds, - ArtifactsFilter... additionalFilters) { + String excludeGroupIds, ArtifactsFilter... additionalFilters) { setExcludes(excludes); setExcludeGroupIds(excludeGroupIds); - setExcludeArtifactIds(excludeArtifactIds); this.additionalFilters = additionalFilters; }