Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.2-beta-1
    • 2.2-beta-3
    • None
    • None
    • Windows Vista

    Description

      I have a parent project and a child project. The child project builds an assembly composed of text files.

      <fileSet>
      <outputDirectory>bin</outputDirectory>
      <directory>src/main/bin</directory>
      <lineEnding>unix</lineEnding>
      <includes>
      <include>*.sh</include>
      </includes>
      </fileSet>

      When I build the assembly from the child project , maven adds unix endings, but when I build it from the parent project, lineEnding is being ignored.

      Attachments

        1. massembly-237.txt
          0.9 kB
          Petar Tahchiev
        2. test.zip
          3 kB
          Sergei Ivanov

        Issue Links

          Activity

            sergei_ivanov@mail.ru Sergei S. Ivanov added a comment - - edited

            We have also stumbled upon this bug and I decided to find out the root cause. I checked out the plugin sources and added extra tracing info to the plugin code. After a few test runs, I realised that the bug can be fixed with a change in a single line of code.

            class/method:
            org.apache.maven.plugin.assembly.format.FileSetFormatter#formatFileSetForAssembly

            patch against version 628941:

            @@ -57,7 +57,7 @@
            -            fileSet.setDirectory( set.getDirectory() );
            +            fileSet.setDirectory( archiveBaseDir.getPath() );
            

            Is there a chance that it will be included in the next release?

            sergei_ivanov@mail.ru Sergei S. Ivanov added a comment - - edited We have also stumbled upon this bug and I decided to find out the root cause. I checked out the plugin sources and added extra tracing info to the plugin code. After a few test runs, I realised that the bug can be fixed with a change in a single line of code. class/method: org.apache.maven.plugin.assembly.format.FileSetFormatter#formatFileSetForAssembly patch against version 628941: @@ -57,7 +57,7 @@ - fileSet.setDirectory( set.getDirectory() ); + fileSet.setDirectory( archiveBaseDir.getPath() ); Is there a chance that it will be included in the next release?

            This is a test project I used to reproduce the problem.

            sergei_ivanov@mail.ru Sergei S. Ivanov added a comment - This is a test project I used to reproduce the problem.
            paranoiabla Petar Tahchiev added a comment -

            Hi Sergei and Todor,

            If you are going to execute Maven from the parent then you should specify the full-path to your directory filesets. If you are going to execute Maven from the child module you can specify either relative or full-path to your directory fileset, like this:

            <fileSet>
            <!-- Copy Unix shell scripts, make sure that line ending is LF and an execution permission is set -->
            <directory>/home/peter/workspace/test/module/src/main/bin</directory>
            <outputDirectory>bin</outputDirectory>
            <includes>
            <include>*.sh</include>
            <include>*.ksh</include>
            <include>*.pl</include>
            </includes>
            <fileMode>0744</fileMode><!-- rwxr..r.. -->
            <lineEnding>unix</lineEnding>
            </fileSet>

            You see how I have specified the complete path to the directory in my fileset?

            In my opnion the maven-assembly should NOT be changed, but I provide a patch if anyone wants to change it. I just add the basedir property to your fileset directory property. In this case you have to specify the directory as relative path.

            HTH, Petar.

            paranoiabla Petar Tahchiev added a comment - Hi Sergei and Todor, If you are going to execute Maven from the parent then you should specify the full-path to your directory filesets. If you are going to execute Maven from the child module you can specify either relative or full-path to your directory fileset, like this: <fileSet> <!-- Copy Unix shell scripts, make sure that line ending is LF and an execution permission is set --> <directory>/home/peter/workspace/test/module/src/main/bin</directory> <outputDirectory>bin</outputDirectory> <includes> <include>*.sh</include> <include>*.ksh</include> <include>*.pl</include> </includes> <fileMode>0744</fileMode><!-- rwxr..r.. --> <lineEnding>unix</lineEnding> </fileSet> You see how I have specified the complete path to the directory in my fileset? In my opnion the maven-assembly should NOT be changed, but I provide a patch if anyone wants to change it. I just add the basedir property to your fileset directory property. In this case you have to specify the directory as relative path. HTH, Petar.
            paranoiabla Petar Tahchiev added a comment -

            Here is the patch. Again IMHO maven devs should NOT apply it .

            paranoiabla Petar Tahchiev added a comment - Here is the patch. Again IMHO maven devs should NOT apply it .

            Fixed by fix for MASSEMBLY-293. I've added two new integration tests to verify this, one for windows and one for unix line endings.

            jdcasey John Dennis Casey added a comment - Fixed by fix for MASSEMBLY-293 . I've added two new integration tests to verify this, one for windows and one for unix line endings.

            People

              jdcasey John Dennis Casey
              tptodorov Todor Todorov
              Votes:
              3 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: