Skip to content

Commit 26a0ca6

Browse files
committed
Remove the last dependency to Plexus by copying the content of the DEFAULTEXCLUDES array.
1 parent 9085e2b commit 26a0ca6

File tree

3 files changed

+82
-11
lines changed

3 files changed

+82
-11
lines changed

pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,6 @@ under the License.
9999
<scope>provided</scope>
100100
</dependency>
101101

102-
<dependency>
103-
<groupId>org.codehaus.plexus</groupId>
104-
<artifactId>plexus-utils</artifactId>
105-
</dependency>
106-
107102
<!-- Test -->
108103
<dependency>
109104
<groupId>org.apache.maven.plugin-testing</groupId>

src/main/java/org/apache/maven/plugins/clean/Selector.java

Lines changed: 80 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
import java.util.LinkedHashSet;
2626
import java.util.Set;
2727

28-
import org.codehaus.plexus.util.DirectoryScanner;
29-
3028
/**
3129
* Determines whether a path is selected for deletion.
3230
* The pathnames used for method parameters will be relative to some base directory
@@ -54,6 +52,85 @@
5452
* @author Martin Desruisseaux
5553
*/
5654
final class Selector implements PathMatcher {
55+
/**
56+
* Patterns which should be excluded by default, like <abbr>SCM</abbr> files.
57+
*
58+
* <p><b>Source:</b> this list is copied from {@code plexus-utils-4.0.2} (released in
59+
* September 23, 2024), class {@code org.codehaus.plexus.util.AbstractScanner}.</p>
60+
*/
61+
private static final String[] DEFAULT_EXCLUDES = {
62+
// Miscellaneous typical temporary files
63+
"**/*~",
64+
"**/#*#",
65+
"**/.#*",
66+
"**/%*%",
67+
"**/._*",
68+
69+
// CVS
70+
"**/CVS",
71+
"**/CVS/**",
72+
"**/.cvsignore",
73+
74+
// RCS
75+
"**/RCS",
76+
"**/RCS/**",
77+
78+
// SCCS
79+
"**/SCCS",
80+
"**/SCCS/**",
81+
82+
// Visual SourceSafe
83+
"**/vssver.scc",
84+
85+
// MKS
86+
"**/project.pj",
87+
88+
// Subversion
89+
"**/.svn",
90+
"**/.svn/**",
91+
92+
// Arch
93+
"**/.arch-ids",
94+
"**/.arch-ids/**",
95+
96+
// Bazaar
97+
"**/.bzr",
98+
"**/.bzr/**",
99+
100+
// SurroundSCM
101+
"**/.MySCMServerInfo",
102+
103+
// Mac
104+
"**/.DS_Store",
105+
106+
// Serena Dimensions Version 10
107+
"**/.metadata",
108+
"**/.metadata/**",
109+
110+
// Mercurial
111+
"**/.hg",
112+
"**/.hg/**",
113+
114+
// git
115+
"**/.git",
116+
"**/.git/**",
117+
"**/.gitignore",
118+
119+
// BitKeeper
120+
"**/BitKeeper",
121+
"**/BitKeeper/**",
122+
"**/ChangeSet",
123+
"**/ChangeSet/**",
124+
125+
// darcs
126+
"**/_darcs",
127+
"**/_darcs/**",
128+
"**/.darcsrepo",
129+
"**/.darcsrepo/**",
130+
"**/-darcs-backup*",
131+
"**/.darcs-temp-mail"
132+
};
133+
57134
/**
58135
* String representation of the normalized include filters.
59136
* This is kept only for {@link #toString()} implementation.
@@ -122,7 +199,7 @@ private static String[] addDefaultExcludes(final String[] excludes, final boolea
122199
if (!useDefaultExcludes) {
123200
return excludes;
124201
}
125-
String[] defaults = DirectoryScanner.DEFAULTEXCLUDES;
202+
String[] defaults = DEFAULT_EXCLUDES;
126203
if (excludes == null || excludes.length == 0) {
127204
return defaults;
128205
} else {

src/test/java/org/apache/maven/plugins/clean/CleanMojoTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141

4242
import static org.apache.maven.api.plugin.testing.MojoExtension.getBasedir;
4343
import static org.apache.maven.api.plugin.testing.MojoExtension.setVariableValueToObject;
44-
import static org.codehaus.plexus.util.IOUtil.copy;
4544
import static org.junit.jupiter.api.Assertions.assertFalse;
4645
import static org.junit.jupiter.api.Assertions.assertNotNull;
4746
import static org.junit.jupiter.api.Assertions.assertThrows;
@@ -215,8 +214,8 @@ public void testFollowLinksWithWindowsJunction() throws Exception {
215214
.start();
216215
process.waitFor();
217216
ByteArrayOutputStream baos = new ByteArrayOutputStream();
218-
copy(process.getInputStream(), baos);
219-
copy(process.getErrorStream(), baos);
217+
process.getInputStream().transferTo(baos);
218+
process.getErrorStream().transferTo(baos);
220219
if (!Files.exists(link)) {
221220
throw new IOException("Unable to create junction: " + baos);
222221
}

0 commit comments

Comments
 (0)