Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
7ab78d1d
Commit
7ab78d1d
authored
May 19, 2014
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #899 from markdingram/master
* pull899: Exact match for groupId excludes
parents
77ae7903
dd83b58b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
4 deletions
+44
-4
AbstractDependencyFilterMojo.java
...ingframework/boot/maven/AbstractDependencyFilterMojo.java
+3
-4
MatchingGroupIdFilter.java
...org/springframework/boot/maven/MatchingGroupIdFilter.java
+28
-0
DependencyFilterMojoTests.java
...springframework/boot/maven/DependencyFilterMojoTests.java
+13
-0
No files found.
spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractDependencyFilterMojo.java
View file @
7ab78d1d
...
@@ -28,7 +28,6 @@ import org.apache.maven.shared.artifact.filter.collection.ArtifactFilterExceptio
...
@@ -28,7 +28,6 @@ import org.apache.maven.shared.artifact.filter.collection.ArtifactFilterExceptio
import
org.apache.maven.shared.artifact.filter.collection.ArtifactIdFilter
;
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.ArtifactsFilter
;
import
org.apache.maven.shared.artifact.filter.collection.FilterArtifacts
;
import
org.apache.maven.shared.artifact.filter.collection.FilterArtifacts
;
import
org.apache.maven.shared.artifact.filter.collection.GroupIdFilter
;
/**
/**
* A base mojo filtering the dependencies of the project.
* A base mojo filtering the dependencies of the project.
...
@@ -48,14 +47,14 @@ public abstract class AbstractDependencyFilterMojo extends AbstractMojo {
...
@@ -48,14 +47,14 @@ public abstract class AbstractDependencyFilterMojo extends AbstractMojo {
private
List
<
Exclude
>
excludes
;
private
List
<
Exclude
>
excludes
;
/**
/**
* Comma separated list of groupId names to exclude.
* Comma separated list of groupId names to exclude
(exact match)
.
* @since 1.1
* @since 1.1
*/
*/
@Parameter
(
property
=
"excludeGroupIds"
,
defaultValue
=
""
)
@Parameter
(
property
=
"excludeGroupIds"
,
defaultValue
=
""
)
private
String
excludeGroupIds
;
private
String
excludeGroupIds
;
/**
/**
* Comma separated list of artifact names to exclude.
* Comma separated list of artifact names to exclude
(exact match)
.
* @since 1.1
* @since 1.1
*/
*/
@Parameter
(
property
=
"excludeArtifactIds"
,
defaultValue
=
""
)
@Parameter
(
property
=
"excludeArtifactIds"
,
defaultValue
=
""
)
...
@@ -96,7 +95,7 @@ public abstract class AbstractDependencyFilterMojo extends AbstractMojo {
...
@@ -96,7 +95,7 @@ public abstract class AbstractDependencyFilterMojo extends AbstractMojo {
}
}
filters
.
addFilter
(
new
ArtifactIdFilter
(
""
,
filters
.
addFilter
(
new
ArtifactIdFilter
(
""
,
cleanFilterConfig
(
this
.
excludeArtifactIds
)));
cleanFilterConfig
(
this
.
excludeArtifactIds
)));
filters
.
addFilter
(
new
GroupIdFilter
(
""
,
cleanFilterConfig
(
this
.
excludeGroupIds
)));
filters
.
addFilter
(
new
MatchingGroupIdFilter
(
cleanFilterConfig
(
this
.
excludeGroupIds
)));
if
(
this
.
excludes
!=
null
)
{
if
(
this
.
excludes
!=
null
)
{
filters
.
addFilter
(
new
ExcludeFilter
(
this
.
excludes
));
filters
.
addFilter
(
new
ExcludeFilter
(
this
.
excludes
));
}
}
...
...
spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/MatchingGroupIdFilter.java
0 → 100644
View file @
7ab78d1d
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
();
}
}
spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/DependencyFilterMojoTests.java
View file @
7ab78d1d
...
@@ -51,6 +51,19 @@ public class DependencyFilterMojoTests {
...
@@ -51,6 +51,19 @@ public class DependencyFilterMojoTests {
assertSame
(
"Wrong filtered artifact"
,
artifact
,
artifacts
.
iterator
().
next
());
assertSame
(
"Wrong filtered artifact"
,
artifact
,
artifacts
.
iterator
().
next
());
}
}
@Test
public
void
filterGroupIdExactMatch
()
throws
MojoExecutionException
{
TestableDependencyFilterMojo
mojo
=
new
TestableDependencyFilterMojo
(
Collections
.<
Exclude
>
emptyList
(),
"com.foo"
,
""
);
Artifact
artifact
=
createArtifact
(
"com.foo.bar"
,
"one"
);
Set
<
Artifact
>
artifacts
=
mojo
.
filterDependencies
(
createArtifact
(
"com.foo"
,
"one"
),
createArtifact
(
"com.foo"
,
"two"
),
artifact
);
assertEquals
(
"wrong filtering of artifacts"
,
1
,
artifacts
.
size
());
assertSame
(
"Wrong filtered artifact"
,
artifact
,
artifacts
.
iterator
().
next
());
}
private
Artifact
createArtifact
(
String
groupId
,
String
artifactId
)
{
private
Artifact
createArtifact
(
String
groupId
,
String
artifactId
)
{
Artifact
a
=
mock
(
Artifact
.
class
);
Artifact
a
=
mock
(
Artifact
.
class
);
given
(
a
.
getGroupId
()).
willReturn
(
groupId
);
given
(
a
.
getGroupId
()).
willReturn
(
groupId
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment