Piotr Lewandowski created ARCHETYPE-605:
-------------------------------------------

             Summary: Allow .gitignore file in archetype resources
                 Key: ARCHETYPE-605
                 URL: https://issues.apache.org/jira/browse/ARCHETYPE-605
             Project: Maven Archetype
          Issue Type: Bug
          Components: Plugin
    Affects Versions: 3.2.0
            Reporter: Piotr Lewandowski


Since 3.2.0 (and plexus-archiver:4.2.2) JAR archive with archetype does not 
include {{.gitignore}} file, despite of fact that this file is located in 
{{archetype-resources}} directory.

In {{JarMojo}} Plexus' {{addDirectory(File)}} method is called.
{code:java}
archiver.getArchiver().addDirectory( archetypeDirectory );{code}
This method does not configure default excludes, that are enabled by default.
{code:java}
    @Override
    public void addDirectory( @Nonnull final File directory )
        throws ArchiverException
    {
        addFileSet(
            fileSet( directory ).prefixed( "" ).includeExclude( null, null 
).includeEmptyDirs( includeEmptyDirs ) );
    }{code}
{{setUsingDefaultExcludes}} method is not called on fileSet here.
Later on, this fileSet is used to create {{PlexusIoFileResourceCollection}} 
object. On this object, {{getResources}} method is called that uses Plexus' 
{{DirectoryScanner}} to find out all resources that should be included into 
final artifact. This scanner uses {{usingDefaultExcludes}} configuration and 
excludes [among the 
others|https://github.com/sonatype/plexus-utils/blob/master/src/main/java/org/codehaus/plexus/util/AbstractScanner.java#L92],
 {{.gitignore}} file.

I have not found any way to configure archetype-archiver to disable default 
excludes. In my opinion current behavior is a regression - custom 
{{.gitignore}} is useful feature in archetypes.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to