Leading slash in Windows when including one file in archive.
------------------------------------------------------------

                 Key: MASSEMBLY-375
                 URL: http://jira.codehaus.org/browse/MASSEMBLY-375
             Project: Maven 2.x Assembly Plugin
          Issue Type: Bug
    Affects Versions: 2.2-beta-3
         Environment: Windows XP, 
java version "1.6.0_11"
Java(TM) SE Runtime Environment (build 1.6.0_11-b03)
Java HotSpot(TM) Client VM (build 11.0-b16, mixed mode, sharing)

Maven version: 2.0.9
Java version: 1.6.0_10
OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"
            Reporter: Petar Tahchiev
         Attachments: massembly-windows-slash.patch

Hi guys,

I found this issue when trying to create an ear file with the maven-assembly 
version 2.2-beta-3 unreleased version.

I used this configration xml:
{quote}
<assembly>
        <id>bin</id>
        <formats>
                <format>ear</format>
        </formats>
        <includeBaseDirectory>false</includeBaseDirectory>
        <fileSets>
                <fileSet>
      <directory>target</directory>
      <outputDirectory>/</outputDirectory>
      <includes>
        <include>cactus.samples.ejb-1.8.1-SNAPSHOT.jar</include>
      </includes>
                </fileSet>
        </fileSets>
</assembly>
{quote}

and this is my pom.xml:
{quote}
                  <plugin>
                                <artifactId>maven-assembly-plugin</artifactId>
                                <version>2.2-beta-3-SNAPSHOT</version>
                                <executions>
                                        <execution>
                                                <id>create-cactus-archive</id>
                                                
<phase>pre-integration-test</phase>
                                                <configuration>
                                        <descriptors>
                                                
<descriptor>src/main/app/main.xml</descriptor>
                                        </descriptors>
                                        <archiverConfig>
                <appxml>src/main/app/application.xml</appxml>
              </archiverConfig>
                                </configuration>
                                                <goals>
                                                        <goal>single</goal>
                                                </goals>
                                        </execution>
                                </executions>
                  </plugin>
{quote}

When executing it on Linux it all works fine, but when executing it on Windows 
I get the cactus file included with a leading slash (see the screenshot).

I found that the execution flow goes this way:

AbstractAssemblyMojo (line 354) -> DefaultAssemblyArchiver (line 187) -> 
FileSetAssemblyPhase (line 69) -> AddFileSetsTask (line 87/167) -> 
AddDirectoryTask (line 116) -> AssemblyProxyArchiver (line 705)

On this line we create a PrefixedFileSet and pass the rootPrefix to be '', 
which is fine. But if we look into the constructor of the 
PrefixedFileSetArchiver we see that it checks to see if the rootPrefix ends 
with a / symbol and in case it doesn't it adds one. Which is exactly our case.  
I think the PrefixedFileSet needs to check also to see if the root prefix is 
not ''. 

I attach a patch that needs to be applied. With this patch it all works well.

I am sorry for not being able to provide an integration test. I will be able to 
provide integration test in a 7-day period if this is fine.

Thanks.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to