Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,6 @@ under the License.
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
</dependency>

<!-- Test -->
<dependency>
<groupId>org.apache.maven.plugin-testing</groupId>
Expand Down
33 changes: 7 additions & 26 deletions src/main/java/org/apache/maven/plugins/clean/CleanMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public class CleanMojo implements org.apache.maven.api.plugin.Mojo {
@Override
public void execute() {
if (skip) {
getLog().info("Clean is skipped.");
logger.info("Clean is skipped.");
return;
}

Expand All @@ -236,7 +236,7 @@ public void execute() {
} else {
fastDir = null;
if (fast) {
getLog().warn("Fast clean requires maven 3.3.1 or newer, "
logger.warn("Fast clean requires maven 3.3.1 or newer, "
+ "or an explicit directory to be specified with the 'fastDir' configuration of "
+ "this plugin, or the 'maven.clean.fastDir' user property to be set.");
}
Expand All @@ -248,37 +248,22 @@ public void execute() {
throw new IllegalArgumentException("Illegal value '" + fastMode + "' for fastMode. Allowed values are '"
+ FAST_MODE_BACKGROUND + "', '" + FAST_MODE_AT_END + "' and '" + FAST_MODE_DEFER + "'.");
}

Cleaner cleaner = new Cleaner(session, getLog(), isVerbose(), fastDir, fastMode);

final var cleaner =
new Cleaner(session, logger, isVerbose(), fastDir, fastMode, followSymLinks, failOnError, retryOnError);
try {
for (Path directoryItem : getDirectories()) {
if (directoryItem != null) {
cleaner.delete(directoryItem, null, followSymLinks, failOnError, retryOnError);
cleaner.delete(directoryItem);
}
}

if (filesets != null) {
for (Fileset fileset : filesets) {
if (fileset.getDirectory() == null) {
throw new MojoException("Missing base directory for " + fileset);
}
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);
cleaner.delete(fileset);
}
}

} catch (IOException e) {
throw new MojoException("Failed to clean project: " + e.getMessage(), e);
}
Expand All @@ -290,7 +275,7 @@ public void execute() {
* @return <code>true</code> if verbose output is enabled, <code>false</code> otherwise.
*/
private boolean isVerbose() {
return (verbose != null) ? verbose : getLog().isDebugEnabled();
return (verbose != null) ? verbose : logger.isDebugEnabled();
}

/**
Expand All @@ -307,8 +292,4 @@ private Path[] getDirectories() {
}
return directories;
}

private Log getLog() {
return logger;
}
}
Loading
Loading