[ 
https://jira.codehaus.org/browse/MASSEMBLY-578?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=280752#comment-280752
 ] 

Elie Delorme commented on MASSEMBLY-578:
----------------------------------------

A workaround is to specify the fileSet twice, once excluding all files that 
will get all directories including empty ones and another including everything 
and specifying the lineEnding parameter.
The resulting archive will contain duplicates with 2.2-beta-2, version 
2.2-beta-3 will produce the result expected.

{noformat}
<assembly
        
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2";
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
 http://maven.apache.org/xsd/assembly-1.1.2.xsd";>
    <id>distribution</id>

    <formats>
        <format>tar.gz</format>
    </formats>

    <fileSets>
        <fileSet>
            <directory>src/main/include</directory>
            <outputDirectory>/</outputDirectory>
            <excludes>
                <exclude>**/*.*</exclude>
            </excludes>
        </fileSet>
        <fileSet>
            <directory>src/main/include</directory>
            <outputDirectory>/</outputDirectory>
            <lineEnding>unix</lineEnding>
        </fileSet>
    </fileSets>
</assembly>
{noformat}

> lineEnding parameter makes assembly ignore empty directories
> ------------------------------------------------------------
>
>                 Key: MASSEMBLY-578
>                 URL: https://jira.codehaus.org/browse/MASSEMBLY-578
>             Project: Maven 2.x Assembly Plugin
>          Issue Type: Bug
>    Affects Versions: 2.2-beta-2
>         Environment: Windows 7 Enterprise x64 sp1
> Apache Maven 2.2.1 (r801777; 2009-08-06 15:16:01-0400)
> Java version: 1.6.0_25
>            Reporter: Elie Delorme
>         Attachments: assembly.xml, pom.xml
>
>
> Empty directories are ignored if the lineEnding parameter is used in a 
> fileset.
> Created archive will contain empty directories if I either remove the 
> lineEnding parameter OR remove any text file from the directory structure.
> structure:
> {noformat}
> pom.xml
> src/main/assembly/assembly.xml
> src/main/include/a/test.txt
>                 /b/
> {noformat}
> pom.xml
> {noformat}
> <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>test</groupId>
>     <artifactId>test</artifactId>
>     <version>0-SNAPSHOT</version>
>     <packaging>pom</packaging>
>     <name>test</name>
>     <build>
>         <plugins>
>             <plugin>
>                 <artifactId>maven-assembly-plugin</artifactId>
>                 <configuration>
>                     <appendAssemblyId>false</appendAssemblyId>
>                     <attach>false</attach>
>                     <descriptors>
>                         
> <descriptor>src/main/assembly/assembly.xml</descriptor>
>                     </descriptors>
>                 </configuration>
>             </plugin>
>         </plugins>
>     </build>
> </project>
> {noformat}
> assembly.xml
> {noformat}
> <assembly
>         
> xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2";
>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>         
> xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
>  http://maven.apache.org/xsd/assembly-1.1.2.xsd";>
>     <id>distribution</id>
>     <formats>
>         <format>tar.gz</format>
>     </formats>
>     <fileSets>
>         <fileSet>
>             <directory>src/main/include</directory>
>             <outputDirectory>/</outputDirectory>
>             <lineEnding>unix</lineEnding>
>         </fileSet>
>     </fileSets>
> </assembly>
> {noformat}
> *test*
> {noformat}
> mvn clean assembly:single
> set MAVEN_OPTS="-Xmx256m"
> [INFO] Scanning for projects...
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Building test
> [INFO]    task-segment: [clean, assembly:single]
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] [clean:clean {execution: default-clean}]
> [INFO] Deleting directory C:\ATM\emptybug\trunk\target
> [INFO] [assembly:single {execution: default-cli}]
> [INFO] Reading assembly descriptor: src/main/assembly/assembly.xml
> [INFO] Building tar : C:\ATM\emptybug\trunk\target\test-0-SNAPSHOT.tar.gz
> [WARNING] Assembly file: C:\ATM\emptybug\trunk\target\test-0-SNAPSHOT.tar.gz 
> is not a regular file (
> it may be a directory). It cannot be attached to the project build for 
> installation or deployment.
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESSFUL
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Total time: 1 second
> [INFO] Finished at: Thu Oct 06 09:06:23 EDT 2011
> [INFO] Final Memory: 8M/162M
> [INFO] 
> ------------------------------------------------------------------------
> bsdtar ztvf target\test-0-SNAPSHOT.tar.gz
> drwxr-xr-x  0 0      0           0 Oct 06 09:06 test-0-SNAPSHOT/
> drwxr-xr-x  0 0      0           0 Oct 06 09:06 test-0-SNAPSHOT/a/
> -rw-r--r--  0 0      0           0 Oct 06 09:06 test-0-SNAPSHOT/a/test.txt
> {noformat}
> *without lineEnding*

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to