You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2026/10/20 09:53:12 UTC
(maven-dependency-plugin) branch master updated (07f69898 -> 365dd0b2)
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/maven-dependency-plugin.git
from 07f69898 Report only the classifier artifacts that failed to resolve
new 03c8508a [MDEP-496] Add useDefaultExcludes to unpack and unpack-dependencies
new 365dd0b2 [MDEP-496] Keep default-excluded entries for includes-only unpacks
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../projects/mdep-496-use-default-excludes/pom.xml | 124 +++++++++++++++++++++
.../1.0/default-excludes-fixture-1.0.jar | Bin 0 -> 774 bytes
.../1.0/default-excludes-fixture-1.0.pom} | 2 +-
.../verify.groovy | 14 ++-
.../dependency/fromConfiguration/UnpackMojo.java | 17 +++
.../fromDependencies/UnpackDependenciesMojo.java | 17 +++
.../maven/plugins/dependency/utils/UnpackUtil.java | 36 ++++++
src/site/markdown/faq.md | 3 +
.../TestUnpackDefaultExcludes.java | 105 +++++++++++++++++
.../TestUnpackDependenciesDefaultExcludes.java | 100 +++++++++++++++++
10 files changed, 411 insertions(+), 7 deletions(-)
create mode 100644 src/it/projects/mdep-496-use-default-excludes/pom.xml
create mode 100644 src/it/projects/mdep-496-use-default-excludes/repo/org/apache/maven/its/dependency/default-excludes-fixture/1.0/default-excludes-fixture-1.0.jar
copy src/it/{mrm/repository/ResourceArtifact-1.0.pom => projects/mdep-496-use-default-excludes/repo/org/apache/maven/its/dependency/default-excludes-fixture/1.0/default-excludes-fixture-1.0.pom} (95%)
copy src/it/projects/{mdep-589-exclude-reactor => mdep-496-use-default-excludes}/verify.groovy (67%)
create mode 100644 src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestUnpackDefaultExcludes.java
create mode 100644 src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestUnpackDependenciesDefaultExcludes.java
(maven-dependency-plugin) 02/02: [MDEP-496] Keep default-excluded entries for includes-only unpacks
Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-dependency-plugin.git
commit 365dd0b2bffeda3139b2c3eb51404e89b365803c
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Tue Oct 13 23:59:14 2026 +0200
[MDEP-496] Keep default-excluded entries for includes-only unpacks
setUseDefaultExcludes() recomputes the exclude patterns, so calling it for a selector without excludes dropped .svn and .git entries that were extracted before. Call it only when excludes are set.
---
.../org/apache/maven/plugins/dependency/utils/UnpackUtil.java | 7 ++++---
.../dependency/fromConfiguration/TestUnpackDefaultExcludes.java | 9 +++++++++
.../fromDependencies/TestUnpackDependenciesDefaultExcludes.java | 9 +++++++++
3 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/apache/maven/plugins/dependency/utils/UnpackUtil.java b/src/main/java/org/apache/maven/plugins/dependency/utils/UnpackUtil.java
index ed9152ee..47253334 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/utils/UnpackUtil.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/utils/UnpackUtil.java
@@ -165,10 +165,11 @@ public class UnpackUtil {
IncludeExcludeFileSelector[] selectors =
new IncludeExcludeFileSelector[] {new IncludeExcludeFileSelector()};
- // must precede setExcludes(), which computes the effective exclude patterns
- selectors[0].setUseDefaultExcludes(useDefaultExcludes);
-
if (excludes != null && !excludes.isEmpty()) {
+ // Only here: setUseDefaultExcludes() recomputes the exclude patterns, so calling it for an
+ // includes-only selector would start dropping .svn, .git and so on, which were extracted so far.
+ // It also has to precede setExcludes().
+ selectors[0].setUseDefaultExcludes(useDefaultExcludes);
selectors[0].setExcludes(excludes.split(","));
}
diff --git a/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestUnpackDefaultExcludes.java b/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestUnpackDefaultExcludes.java
index c47c1eea..027c3d1f 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestUnpackDefaultExcludes.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestUnpackDefaultExcludes.java
@@ -93,4 +93,13 @@ class TestUnpackDefaultExcludes {
assertFalse(new File(mojo.getOutputDirectory(), "dropped.log").exists());
assertTrue(new File(mojo.getOutputDirectory(), ".svn/entries").exists());
}
+
+ @Test
+ @InjectMojo(goal = "unpack")
+ void testIncludesOnlyKeepsDefaultExcludedEntries(UnpackMojo mojo) throws Exception {
+ mojo.setIncludes("**/*");
+ mojo.execute();
+ assertTrue(new File(mojo.getOutputDirectory(), "kept.txt").exists());
+ assertTrue(new File(mojo.getOutputDirectory(), ".svn/entries").exists());
+ }
}
diff --git a/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestUnpackDependenciesDefaultExcludes.java b/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestUnpackDependenciesDefaultExcludes.java
index 5e1a931f..f7a657c4 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestUnpackDependenciesDefaultExcludes.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestUnpackDependenciesDefaultExcludes.java
@@ -88,4 +88,13 @@ class TestUnpackDependenciesDefaultExcludes {
assertFalse(new File(mojo.getOutputDirectory(), "dropped.log").exists());
assertTrue(new File(mojo.getOutputDirectory(), ".svn/entries").exists());
}
+
+ @Test
+ @InjectMojo(goal = "unpack-dependencies")
+ void testIncludesOnlyKeepsDefaultExcludedEntries(UnpackDependenciesMojo mojo) throws Exception {
+ mojo.setIncludes("**/*");
+ mojo.execute();
+ assertTrue(new File(mojo.getOutputDirectory(), "kept.txt").exists());
+ assertTrue(new File(mojo.getOutputDirectory(), ".svn/entries").exists());
+ }
}
(maven-dependency-plugin) 01/02: [MDEP-496] Add useDefaultExcludes to unpack and unpack-dependencies
Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-dependency-plugin.git
commit 03c8508aee7a96af4d06d086824d26537578e6a6
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Tue Oct 13 23:37:56 2026 +0200
[MDEP-496] Add useDefaultExcludes to unpack and unpack-dependencies
---
.../projects/mdep-496-use-default-excludes/pom.xml | 124 +++++++++++++++++++++
.../1.0/default-excludes-fixture-1.0.jar | Bin 0 -> 774 bytes
.../1.0/default-excludes-fixture-1.0.pom | 30 +++++
.../mdep-496-use-default-excludes/verify.groovy | 30 +++++
.../dependency/fromConfiguration/UnpackMojo.java | 17 +++
.../fromDependencies/UnpackDependenciesMojo.java | 17 +++
.../maven/plugins/dependency/utils/UnpackUtil.java | 35 ++++++
src/site/markdown/faq.md | 3 +
.../TestUnpackDefaultExcludes.java | 96 ++++++++++++++++
.../TestUnpackDependenciesDefaultExcludes.java | 91 +++++++++++++++
10 files changed, 443 insertions(+)
diff --git a/src/it/projects/mdep-496-use-default-excludes/pom.xml b/src/it/projects/mdep-496-use-default-excludes/pom.xml
new file mode 100644
index 00000000..57e12dc4
--- /dev/null
+++ b/src/it/projects/mdep-496-use-default-excludes/pom.xml
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.plugins.dependency.its</groupId>
+ <artifactId>mdep-496-use-default-excludes</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <description>Unpacking with excludes set skips .svn by default, and extracts it with useDefaultExcludes=false</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.its.dependency</groupId>
+ <artifactId>default-excludes-fixture</artifactId>
+ <version>1.0</version>
+ </dependency>
+ </dependencies>
+
+ <repositories>
+ <repository>
+ <id>fake-remote-repository</id>
+ <url>file:///${basedir}/repo/</url>
+ <releases>
+ <checksumPolicy>ignore</checksumPolicy>
+ </releases>
+ </repository>
+ </repositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <id>unpack-dependencies-default</id>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>unpack-dependencies</goal>
+ </goals>
+ <configuration>
+ <excludes>**/*.log</excludes>
+ <outputDirectory>${project.build.directory}/dependencies-default</outputDirectory>
+ <markersDirectory>${project.build.directory}/markers-dependencies-default</markersDirectory>
+ </configuration>
+ </execution>
+ <execution>
+ <id>unpack-dependencies-no-default-excludes</id>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>unpack-dependencies</goal>
+ </goals>
+ <configuration>
+ <excludes>**/*.log</excludes>
+ <useDefaultExcludes>false</useDefaultExcludes>
+ <outputDirectory>${project.build.directory}/dependencies-no-default-excludes</outputDirectory>
+ <markersDirectory>${project.build.directory}/markers-dependencies-no-default-excludes</markersDirectory>
+ </configuration>
+ </execution>
+ <execution>
+ <id>unpack-default</id>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.maven.its.dependency</groupId>
+ <artifactId>default-excludes-fixture</artifactId>
+ <version>1.0</version>
+ </artifactItem>
+ </artifactItems>
+ <excludes>**/*.log</excludes>
+ <outputDirectory>${project.build.directory}/unpack-default</outputDirectory>
+ <markersDirectory>${project.build.directory}/markers-unpack-default</markersDirectory>
+ </configuration>
+ </execution>
+ <execution>
+ <id>unpack-no-default-excludes</id>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.maven.its.dependency</groupId>
+ <artifactId>default-excludes-fixture</artifactId>
+ <version>1.0</version>
+ </artifactItem>
+ </artifactItems>
+ <excludes>**/*.log</excludes>
+ <useDefaultExcludes>false</useDefaultExcludes>
+ <outputDirectory>${project.build.directory}/unpack-no-default-excludes</outputDirectory>
+ <markersDirectory>${project.build.directory}/markers-unpack-no-default-excludes</markersDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/src/it/projects/mdep-496-use-default-excludes/repo/org/apache/maven/its/dependency/default-excludes-fixture/1.0/default-excludes-fixture-1.0.jar b/src/it/projects/mdep-496-use-default-excludes/repo/org/apache/maven/its/dependency/default-excludes-fixture/1.0/default-excludes-fixture-1.0.jar
new file mode 100644
index 00000000..2c5cc324
Binary files /dev/null and b/src/it/projects/mdep-496-use-default-excludes/repo/org/apache/maven/its/dependency/default-excludes-fixture/1.0/default-excludes-fixture-1.0.jar differ
diff --git a/src/it/projects/mdep-496-use-default-excludes/repo/org/apache/maven/its/dependency/default-excludes-fixture/1.0/default-excludes-fixture-1.0.pom b/src/it/projects/mdep-496-use-default-excludes/repo/org/apache/maven/its/dependency/default-excludes-fixture/1.0/default-excludes-fixture-1.0.pom
new file mode 100644
index 00000000..0454284d
--- /dev/null
+++ b/src/it/projects/mdep-496-use-default-excludes/repo/org/apache/maven/its/dependency/default-excludes-fixture/1.0/default-excludes-fixture-1.0.pom
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.its.dependency</groupId>
+ <artifactId>default-excludes-fixture</artifactId>
+ <version>1.0</version>
+ <packaging>jar</packaging>
+
+</project>
diff --git a/src/it/projects/mdep-496-use-default-excludes/verify.groovy b/src/it/projects/mdep-496-use-default-excludes/verify.groovy
new file mode 100644
index 00000000..79474b5c
--- /dev/null
+++ b/src/it/projects/mdep-496-use-default-excludes/verify.groovy
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+def target = new File( basedir, "target" )
+
+['dependencies', 'unpack'].each { prefix ->
+ assert new File( target, "${prefix}-default/kept.txt" ).isFile()
+ assert !new File( target, "${prefix}-default/.svn/entries" ).exists()
+
+ assert new File( target, "${prefix}-no-default-excludes/kept.txt" ).isFile()
+ assert new File( target, "${prefix}-no-default-excludes/.svn/entries" ).isFile()
+}
+
+return true
diff --git a/src/main/java/org/apache/maven/plugins/dependency/fromConfiguration/UnpackMojo.java b/src/main/java/org/apache/maven/plugins/dependency/fromConfiguration/UnpackMojo.java
index 9c00cd96..f90a2cd7 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/fromConfiguration/UnpackMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/fromConfiguration/UnpackMojo.java
@@ -80,6 +80,15 @@ public class UnpackMojo extends AbstractFromConfigurationMojo {
@Parameter(property = "mdep.unpack.excludes")
private String excludes;
+ /**
+ * Whether to apply the default excludes (for example {@code .svn}, {@code CVS} and {@code .git}) when excludes
+ * are set. Set to {@code false} to unpack such files and directories as well.
+ *
+ * @since 3.12.0
+ */
+ @Parameter(property = "mdep.unpack.useDefaultExcludes", defaultValue = "true")
+ private boolean useDefaultExcludes = true;
+
/**
* Ignore to set file permissions when unpacking a dependency.
*
@@ -165,6 +174,7 @@ public class UnpackMojo extends AbstractFromConfigurationMojo {
artifactItem.getOutputDirectory(),
artifactItem.getIncludes(),
artifactItem.getExcludes(),
+ useDefaultExcludes,
artifactItem.getEncoding(),
ignorePermissions,
artifactItem.getFileMappers(),
@@ -227,6 +237,13 @@ public class UnpackMojo extends AbstractFromConfigurationMojo {
this.excludes = excludes;
}
+ /**
+ * @param useDefaultExcludes whether the default excludes are applied when excludes are set
+ */
+ public void setUseDefaultExcludes(boolean useDefaultExcludes) {
+ this.useDefaultExcludes = useDefaultExcludes;
+ }
+
/**
* @return returns a comma separated list of included items
*/
diff --git a/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/UnpackDependenciesMojo.java b/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/UnpackDependenciesMojo.java
index d65d42ab..c8df4f1f 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/UnpackDependenciesMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/UnpackDependenciesMojo.java
@@ -77,6 +77,15 @@ public class UnpackDependenciesMojo extends AbstractFromDependenciesMojo {
@Parameter(property = "mdep.unpack.excludes")
private String excludes;
+ /**
+ * Whether to apply the default excludes (for example {@code .svn}, {@code CVS} and {@code .git}) when excludes
+ * are set. Set to {@code false} to unpack such files and directories as well.
+ *
+ * @since 3.12.0
+ */
+ @Parameter(property = "mdep.unpack.useDefaultExcludes", defaultValue = "true")
+ private boolean useDefaultExcludes = true;
+
/**
* Ignore to set file permissions when unpacking a dependency.
*
@@ -148,6 +157,7 @@ public class UnpackDependenciesMojo extends AbstractFromDependenciesMojo {
destDir,
getIncludes(),
getExcludes(),
+ useDefaultExcludes,
getEncoding(),
ignorePermissions,
getFileMappers(),
@@ -184,6 +194,13 @@ public class UnpackDependenciesMojo extends AbstractFromDependenciesMojo {
this.excludes = excludes;
}
+ /**
+ * @param useDefaultExcludes whether the default excludes are applied when excludes are set
+ */
+ public void setUseDefaultExcludes(boolean useDefaultExcludes) {
+ this.useDefaultExcludes = useDefaultExcludes;
+ }
+
/**
* @return returns a comma separated list of included items
*/
diff --git a/src/main/java/org/apache/maven/plugins/dependency/utils/UnpackUtil.java b/src/main/java/org/apache/maven/plugins/dependency/utils/UnpackUtil.java
index 4f1c552a..ed9152ee 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/utils/UnpackUtil.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/utils/UnpackUtil.java
@@ -66,6 +66,8 @@ public class UnpackUtil {
}
/**
+ * Unpacks with the default excludes (such as {@code .svn} and {@code .git}) applied whenever excludes are set.
+ *
* @param file file to unpack
* @param type file / artifact type
* @param location the location
@@ -74,6 +76,35 @@ public class UnpackUtil {
* @param encoding the encoding
* @param ignorePermissions ignore permissions
* @param fileMappers {@link FileMapper}s to be used for rewriting each target path, or {@code null} if no
+ * rewriting shall happen
+ * @param logger a Mojo logger
+ * @throws MojoExecutionException in case of an error
+ */
+ public void unpack(
+ File file,
+ String type,
+ File location,
+ String includes,
+ String excludes,
+ String encoding,
+ boolean ignorePermissions,
+ FileMapper[] fileMappers,
+ Log logger)
+ throws MojoExecutionException {
+ unpack(file, type, location, includes, excludes, true, encoding, ignorePermissions, fileMappers, logger);
+ }
+
+ /**
+ * @param file file to unpack
+ * @param type file / artifact type
+ * @param location the location
+ * @param includes includes list
+ * @param excludes excludes list
+ * @param useDefaultExcludes whether the default excludes (such as {@code .svn} and {@code .git}) are applied
+ * when excludes are set
+ * @param encoding the encoding
+ * @param ignorePermissions ignore permissions
+ * @param fileMappers {@link FileMapper}s to be used for rewriting each target path, or {@code null} if no
* rewriting
* shall happen
* @param logger a Mojo logger
@@ -85,6 +116,7 @@ public class UnpackUtil {
File location,
String includes,
String excludes,
+ boolean useDefaultExcludes,
String encoding,
boolean ignorePermissions,
FileMapper[] fileMappers,
@@ -133,6 +165,9 @@ public class UnpackUtil {
IncludeExcludeFileSelector[] selectors =
new IncludeExcludeFileSelector[] {new IncludeExcludeFileSelector()};
+ // must precede setExcludes(), which computes the effective exclude patterns
+ selectors[0].setUseDefaultExcludes(useDefaultExcludes);
+
if (excludes != null && !excludes.isEmpty()) {
selectors[0].setExcludes(excludes.split(","));
}
diff --git a/src/site/markdown/faq.md b/src/site/markdown/faq.md
index 8c813532..2cfc901d 100644
--- a/src/site/markdown/faq.md
+++ b/src/site/markdown/faq.md
@@ -84,6 +84,9 @@ you will exclude everything. If you only want foo, then just specify the include
unpack uses the following code to determine which files to unpack:
`return isIncluded( name ) AND !isExcluded( name );`
+When excludes are set, the default excludes of the file selector (for example `.svn`, `CVS` and `.git`) apply as well.
+Set `useDefaultExcludes` to `false` to unpack those files too.
+
<a id="unused"></a>
### Why does my dependency analysis report `Unused declared dependencies`?
diff --git a/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestUnpackDefaultExcludes.java b/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestUnpackDefaultExcludes.java
new file mode 100644
index 00000000..c47c1eea
--- /dev/null
+++ b/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestUnpackDefaultExcludes.java
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.plugins.dependency.fromConfiguration;
+
+import javax.inject.Inject;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+import org.apache.maven.api.plugin.testing.Basedir;
+import org.apache.maven.api.plugin.testing.InjectMojo;
+import org.apache.maven.api.plugin.testing.MojoParameter;
+import org.apache.maven.api.plugin.testing.MojoTest;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.plugins.dependency.testUtils.DependencyArtifactStubFactory;
+import org.apache.maven.project.MavenProject;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * MDEP-496: the default excludes of the file selector must be switchable.
+ */
+@MojoTest(realRepositorySession = true)
+@Basedir("/unit/unpack-dependencies-test")
+@MojoParameter(name = "artifact", value = "test:test:1.0")
+class TestUnpackDefaultExcludes {
+ @TempDir
+ private File tempDir;
+
+ @Inject
+ private MavenSession session;
+
+ @Inject
+ private MavenProject project;
+
+ @BeforeEach
+ void setUp() throws Exception {
+ File zip = new File(tempDir, "with-svn.zip");
+ try (ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zip))) {
+ for (String name : new String[] {"kept.txt", "dropped.log", ".svn/entries"}) {
+ out.putNextEntry(new ZipEntry(name));
+ out.write(name.getBytes("UTF-8"));
+ out.closeEntry();
+ }
+ }
+ DependencyArtifactStubFactory stubFactory = new DependencyArtifactStubFactory(tempDir, true, false);
+ stubFactory.setSrcFile(zip);
+ stubFactory.createArtifact("test", "test", "1.0", Artifact.SCOPE_COMPILE, "jar", null);
+ session.getRequest().setLocalRepositoryPath(new File(tempDir, "localTestRepo"));
+ project.getBuild().setDirectory(new File(tempDir, "target").getAbsolutePath());
+ }
+
+ @Test
+ @InjectMojo(goal = "unpack")
+ void testDefaultExcludesApplyWhenExcludesAreSet(UnpackMojo mojo) throws Exception {
+ mojo.setExcludes("**/*.log");
+ mojo.execute();
+ assertTrue(new File(mojo.getOutputDirectory(), "kept.txt").exists());
+ assertFalse(new File(mojo.getOutputDirectory(), "dropped.log").exists());
+ assertFalse(new File(mojo.getOutputDirectory(), ".svn/entries").exists());
+ }
+
+ @Test
+ @InjectMojo(goal = "unpack")
+ void testDefaultExcludesCanBeDisabled(UnpackMojo mojo) throws Exception {
+ mojo.setExcludes("**/*.log");
+ mojo.setUseDefaultExcludes(false);
+ mojo.execute();
+ assertTrue(new File(mojo.getOutputDirectory(), "kept.txt").exists());
+ assertFalse(new File(mojo.getOutputDirectory(), "dropped.log").exists());
+ assertTrue(new File(mojo.getOutputDirectory(), ".svn/entries").exists());
+ }
+}
diff --git a/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestUnpackDependenciesDefaultExcludes.java b/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestUnpackDependenciesDefaultExcludes.java
new file mode 100644
index 00000000..5e1a931f
--- /dev/null
+++ b/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestUnpackDependenciesDefaultExcludes.java
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.plugins.dependency.fromDependencies;
+
+import javax.inject.Inject;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.util.Set;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+import org.apache.maven.api.plugin.testing.Basedir;
+import org.apache.maven.api.plugin.testing.InjectMojo;
+import org.apache.maven.api.plugin.testing.MojoTest;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugins.dependency.testUtils.DependencyArtifactStubFactory;
+import org.apache.maven.project.MavenProject;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * MDEP-496: the default excludes of the file selector must be switchable.
+ */
+@MojoTest
+@Basedir("/unit/unpack-dependencies-test")
+class TestUnpackDependenciesDefaultExcludes {
+ @TempDir
+ private File tempDir;
+
+ @Inject
+ private MavenProject project;
+
+ @BeforeEach
+ void setUp() throws Exception {
+ File zip = new File(tempDir, "with-svn.zip");
+ try (ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zip))) {
+ for (String name : new String[] {"kept.txt", "dropped.log", ".svn/entries"}) {
+ out.putNextEntry(new ZipEntry(name));
+ out.write(name.getBytes("UTF-8"));
+ out.closeEntry();
+ }
+ }
+ DependencyArtifactStubFactory stubFactory = new DependencyArtifactStubFactory(tempDir, true, false);
+ stubFactory.setSrcFile(zip);
+ project.getBuild().setDirectory(new File(tempDir, "target").getAbsolutePath());
+ Set<Artifact> artifacts = stubFactory.getScopedArtifacts();
+ project.setArtifacts(artifacts);
+ }
+
+ @Test
+ @InjectMojo(goal = "unpack-dependencies")
+ void testDefaultExcludesApplyWhenExcludesAreSet(UnpackDependenciesMojo mojo) throws Exception {
+ mojo.setExcludes("**/*.log");
+ mojo.execute();
+ assertTrue(new File(mojo.getOutputDirectory(), "kept.txt").exists());
+ assertFalse(new File(mojo.getOutputDirectory(), "dropped.log").exists());
+ assertFalse(new File(mojo.getOutputDirectory(), ".svn/entries").exists());
+ }
+
+ @Test
+ @InjectMojo(goal = "unpack-dependencies")
+ void testDefaultExcludesCanBeDisabled(UnpackDependenciesMojo mojo) throws Exception {
+ mojo.setExcludes("**/*.log");
+ mojo.setUseDefaultExcludes(false);
+ mojo.execute();
+ assertTrue(new File(mojo.getOutputDirectory(), "kept.txt").exists());
+ assertFalse(new File(mojo.getOutputDirectory(), "dropped.log").exists());
+ assertTrue(new File(mojo.getOutputDirectory(), ".svn/entries").exists());
+ }
+}