Skip to content

Commit

Permalink
Fix fast delete feature.
Browse files Browse the repository at this point in the history
Pass GlobSelector instance into delete() only if it matters.
  • Loading branch information
wilx committed Oct 18, 2023
1 parent f698995 commit 540c09b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/main/java/org/apache/maven/plugins/clean/CleanMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,17 @@ public void execute() throws MojoExecutionException {
if (fileset.getDirectory() == null) {
throw new MojoExecutionException("Missing base directory for " + fileset);
}
GlobSelector selector = new GlobSelector(
fileset.getIncludes(), fileset.getExcludes(), fileset.isUseDefaultExcludes());
final String[] includes = fileset.getIncludes();
final String[] excludes = fileset.getExcludes();
final boolean useDefaultExcludes = fileset.isUseDefaultExcludes();
final GlobSelector selector;
if ((includes != null && includes.length != 0)
|| (excludes != null && excludes.length != 0)
|| useDefaultExcludes) {
selector = new GlobSelector(includes, excludes, useDefaultExcludes);
} else {
selector = null;
}
cleaner.delete(
fileset.getDirectory(), selector, fileset.isFollowSymlinks(), failOnError, retryOnError);
}
Expand Down

0 comments on commit 540c09b

Please sign in to comment.