You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2020/10/27 19:27:44 UTC
[maven-archetype] 01/07: - There is no way to include .gitignore
files for the jar goal
This is an automated email from the ASF dual-hosted git repository.
rfscholte pushed a commit to branch ARCHETYPE-606
in repository https://gitbox.apache.org/repos/asf/maven-archetype.git
commit 0e2232758725690915fea559a8a846ad24ff3f82
Author: Peter Lamby <pe...@direkt-gruppe.de>
AuthorDate: Wed Oct 7 14:33:18 2020 +0200
- There is no way to include .gitignore files for the jar goal
It was impossible to include files which are by default excluded
by plexus-archiver like .gitignore. This patch enables plexus-archiver
to add these files.
---
.../src/main/java/org/apache/maven/archetype/mojos/JarMojo.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/JarMojo.java b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/JarMojo.java
index c950f38..2e72a4e 100644
--- a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/JarMojo.java
+++ b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/JarMojo.java
@@ -37,6 +37,7 @@ import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.archiver.Archiver;
import org.codehaus.plexus.archiver.jar.JarArchiver;
+import org.codehaus.plexus.archiver.util.DefaultFileSet;
import java.io.File;
import java.util.Map;
@@ -136,7 +137,10 @@ public class JarMojo
try
{
- archiver.getArchiver().addDirectory( archetypeDirectory );
+ DefaultFileSet fs = DefaultFileSet.fileSet( archetypeDirectory ).prefixed( "" )
+ .includeExclude( null, null ).includeEmptyDirs( true );
+ fs.setUsingDefaultExcludes( false );
+ archiver.getArchiver().addFileSet( fs );
archiver.createArchive( session, project, archive );
}