Grégory Joseph created ARCHETYPE-458: ----------------------------------------
Summary: Ability to generate empty directories... with Git or other excluded files. Key: ARCHETYPE-458 URL: https://jira.codehaus.org/browse/ARCHETYPE-458 Project: Maven Archetype Issue Type: Bug Affects Versions: 2.2 Reporter: Grégory Joseph 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 (v6.1.6#6162)