[ 
https://issues.apache.org/jira/browse/ARCHETYPE-458?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Michael Osipov closed ARCHETYPE-458.
------------------------------------
    Resolution: Auto Closed

This issue has been auto closed because it has been inactive for a long period 
of time. If you think this issue still applies, retest your problem with the 
most recent version of Maven and the affected component, reopen and post your 
results.

> Ability to generate empty directories... with Git or other excluded files.
> --------------------------------------------------------------------------
>
>                 Key: ARCHETYPE-458
>                 URL: https://issues.apache.org/jira/browse/ARCHETYPE-458
>             Project: Maven Archetype
>          Issue Type: Bug
>    Affects Versions: 2.2
>            Reporter: Grégory Joseph
>            Priority: Major
>
> Ok, so following ARCHETYPE-157, empty directories can be generated by 
> configuring {{includeEmptyDirs}} for the {{maven-resources-plugin}}. However, 
> if one is using Git (or presumably other VCS behaving similarly), really 
> empty directories can't really be source-controlled.
> I was hoping to be able to use the usual git trick of having 
> {{.empty-placeholder}} files in my archetype sources. That works, those files 
> are in the archetype jar, even without reconfiguring the resources plugin. My 
> next step was thus to configure my {{fileSet}} as such:
> {code}
> <fileSet encoding="UTF-8">
>           <directory>src/main/webapp/</directory>
>           <excludes>
>             <exclude>**/.emptydir-placeholder</exclude>
>           </excludes>
>           <includes>
>             <include>**/*</include>
>           </includes>
>         </fileSet>
> {code}
> However, this doesn't work, for a combination of two reasons, I believe:
> * The archetype jar does not contain *directory* entries when files are in 
> these directories (regardless of {{includeEmptyDirs}})
> * The archetype:generate mojo copies a fileset by looking directly are the 
> zip entries, not by somehow normalizing those entries. So it sees no entry 
> for my "empty" directory {{/foo}}, but only the one 
> {{/foo/.empty-placeholder}} entry, which is excluded. 
> As a consequence, the empty directory is, well, excluded and not generated.
> I haven't found a way to force the addition of directory entries in the 
> archetype jar ({{archetype:jar}}'s configuration is pretty limited, and seems 
> to generate the artifact on its own (straight to a ZipOutputStream)
> A workaround is to not exclude the {{**/.emptydir-placeholder}} files in the 
> archetype descriptor, but rather in the {{<resources>}} section of the build 
> - so I can keep them in my Git-managed sources, but they're not in the 
> archetype artifact. This somehow feels less elegant to me, but I'll give it a 
> go anyway.
> {code}
> <build>
>   <resources>
>     <resource>
>         <directory>src/main/resources</directory>
>         <excludes>
>           <exclude>**/.emptydir-placeholder</exclude>
>         </excludes>
>       </resource>
> ...
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to