Details

    • Type: Wish Wish
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.2-beta-2
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      linux, ubuntu
    • Patch Submitted:
      Yes
    • Number of attachments :
      2

      Description

      i need to buid archives ( tar for example ) with symbolic links

      the plugin build an archive with a file containing the destination of the link, not the link itself

      => the plugin need an option to know if deferencement of links is needed
      this is just like -h option of tar
      -h, --dereference
      don't dump symlinks; dump the files they point to

      actually, if you do an archive of /lib, for example, many file will be in double with différent names. extract of archive will not be the exactly the same as the source of the archive. => this is a test !

        Issue Links

          Activity

          Hide
          Zuhayr Khan added a comment - - edited

          I have implemented a solution for symbolic link support in maven-assembly-plugin with changes to plexus-io and plexus-archive (see my comments on PLXCOMP-117)

          I added definitions to the assembly format that allow for symlinks to be defined in an assembly.xml as follows...

          <symlinks>
          <symlink>
          <name>symlink_name</name>
          <destination>../symlink_destination</destination>
          </symlink>
          </symlinks>

          ...I think this is in-keeping with other resources, but I'm happy to hear others' views.

          I will attach a patch for consideration; I think/hope I have followed the coding standards - I am watching this and PLXCOMP-117 so please feel free to ask any questions through comments on whichever is appropriate.

          Show
          Zuhayr Khan added a comment - - edited I have implemented a solution for symbolic link support in maven-assembly-plugin with changes to plexus-io and plexus-archive (see my comments on PLXCOMP-117 ) I added definitions to the assembly format that allow for symlinks to be defined in an assembly.xml as follows... <symlinks> <symlink> <name>symlink_name</name> <destination>../symlink_destination</destination> </symlink> </symlinks> ...I think this is in-keeping with other resources, but I'm happy to hear others' views. I will attach a patch for consideration; I think/hope I have followed the coding standards - I am watching this and PLXCOMP-117 so please feel free to ask any questions through comments on whichever is appropriate.
          Hide
          Zuhayr Khan added a comment -

          This patch (MASSEMBLY-343_maven-assembly-plugin.patch) adds support for symlinks to maven-assembly-plugin

          Show
          Zuhayr Khan added a comment - This patch ( MASSEMBLY-343 _maven-assembly-plugin.patch) adds support for symlinks to maven-assembly-plugin
          Hide
          Ahmed El-Madhoun added a comment -

          Hi Zuhayr,

          I am running into a similar issue where I really need to support sym links as part of the assembly procedure. Do you know what version of the assembly plugin this patch is for? I would like to apply this patch and use it if possible.

          Thanks in advance.

          Show
          Ahmed El-Madhoun added a comment - Hi Zuhayr, I am running into a similar issue where I really need to support sym links as part of the assembly procedure. Do you know what version of the assembly plugin this patch is for? I would like to apply this patch and use it if possible. Thanks in advance.
          Hide
          Zuhayr Khan added a comment - - edited

          Hi Ahmed,

          The version I had locally which I patched was maven-assembly-plugin:2.2.1

          Hope that helps.

          BTW.. there's more comment and discussion on it's possible inclusion on the PLXCOMP-117 issue. I'm more than happy to adjust/re-work these solutions so it can form part of the actual released plugin if there's sufficient interest.

          Zuhayr

          Show
          Zuhayr Khan added a comment - - edited Hi Ahmed, The version I had locally which I patched was maven-assembly-plugin:2.2.1 Hope that helps. BTW.. there's more comment and discussion on it's possible inclusion on the PLXCOMP-117 issue. I'm more than happy to adjust/re-work these solutions so it can form part of the actual released plugin if there's sufficient interest. Zuhayr
          Hide
          Ahmed El-Madhoun added a comment -

          Hi Zuhayr,

          Thanks for the response. I am trying out this patch and I am just having little trouble applying the patches. From what you have told me, I am using the following maven plugin and plexus components:

          maven-assembly-plugin 2.2.1
          plexus-archiver 1.1
          plexus-io 1.0.1

          I do get some failures applying the patch, I did not look further into it, but I will later tonight. I just want to check that I am using the right versions.

          Thanks again and great work so far, any reason why this is not yet officially incorporated?

          Show
          Ahmed El-Madhoun added a comment - Hi Zuhayr, Thanks for the response. I am trying out this patch and I am just having little trouble applying the patches. From what you have told me, I am using the following maven plugin and plexus components: maven-assembly-plugin 2.2.1 plexus-archiver 1.1 plexus-io 1.0.1 I do get some failures applying the patch, I did not look further into it, but I will later tonight. I just want to check that I am using the right versions. Thanks again and great work so far, any reason why this is not yet officially incorporated?
          Hide
          Ahmed El-Madhoun added a comment -

          Hi Zuhayr,

          I was able to get the proper revisions of the maven plugins and plexus components (as listed above), however, I am having trouble building the assembly plugin. All code patches fine, except that I run into this issue:

          [INFO] -------------------------------------------------------------
          [ERROR] COMPILATION ERROR :
          [INFO] -------------------------------------------------------------
          [ERROR] /home/aelmadho/ASSEMBLY/maven/plugins/maven-assembly-plugin-2.2.1/target/generated-sources/modello/org/apache/maven/plugin/assembly/model/io/xpp3/AssemblyXpp3Writer.java:[291,119] error: unclosed string literal
          [ERROR] /home/aelmadho/ASSEMBLY/maven/plugins/maven-assembly-plugin-2.2.1/target/generated-sources/modello/org/apache/maven/plugin/assembly/model/io/xpp3/AssemblyXpp3Writer.java:[292,10] error: unclosed string lite

          The file in context (AssemblyXpp3Writer) looks like this at line 291-292:

          if ( ( dependencySet.getOutputFileNameMapping() != null ) && !dependencySet.getOutputFileNameMapping().equals( "$

          {artifact.artifactId}

          $

          {artifact.version}

          $

          {dashClassifier?}

          .$

          {artifact.extension}

          " ) )

          { serializer.startTag( NAMESPACE, "outputFileNameMapping" ).text( dependencySet.getOutputFileNameMapping() ).endTag( NAMESPACE, "outputFileNameMapping" ); }

          There seems to be a "\n" character at the end of the logical comparison that the parser fails. I am not very familiar with Xpp3, I need to do some more reading there, but I was hoping to try and generate maven artifacts including symlinks using the solution you have proposed.

          Any idea on how I can proceed?

          Thanks a bunch.

          Show
          Ahmed El-Madhoun added a comment - Hi Zuhayr, I was able to get the proper revisions of the maven plugins and plexus components (as listed above), however, I am having trouble building the assembly plugin. All code patches fine, except that I run into this issue: [INFO] ------------------------------------------------------------- [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] /home/aelmadho/ASSEMBLY/maven/plugins/maven-assembly-plugin-2.2.1/target/generated-sources/modello/org/apache/maven/plugin/assembly/model/io/xpp3/AssemblyXpp3Writer.java: [291,119] error: unclosed string literal [ERROR] /home/aelmadho/ASSEMBLY/maven/plugins/maven-assembly-plugin-2.2.1/target/generated-sources/modello/org/apache/maven/plugin/assembly/model/io/xpp3/AssemblyXpp3Writer.java: [292,10] error: unclosed string lite The file in context (AssemblyXpp3Writer) looks like this at line 291-292: if ( ( dependencySet.getOutputFileNameMapping() != null ) && !dependencySet.getOutputFileNameMapping().equals( "$ {artifact.artifactId} $ {artifact.version} $ {dashClassifier?} .$ {artifact.extension} " ) ) { serializer.startTag( NAMESPACE, "outputFileNameMapping" ).text( dependencySet.getOutputFileNameMapping() ).endTag( NAMESPACE, "outputFileNameMapping" ); } There seems to be a "\n" character at the end of the logical comparison that the parser fails. I am not very familiar with Xpp3, I need to do some more reading there, but I was hoping to try and generate maven artifacts including symlinks using the solution you have proposed. Any idea on how I can proceed? Thanks a bunch.
          Hide
          Zuhayr Khan added a comment -

          Thanks Ahmed - seems a rogue line-ending caused the issue you noted.

          I now attached a fixed version of the patch. Hopefully this should solve your problem.

          Zuhayr

          Show
          Zuhayr Khan added a comment - Thanks Ahmed - seems a rogue line-ending caused the issue you noted. I now attached a fixed version of the patch. Hopefully this should solve your problem. Zuhayr
          Hide
          Ahmed El-Madhoun added a comment -

          Hi Zuhayr,

          Thanks for the fix, I am now able to build and test the patch. I am not seeing the symlinks respected. I am simply using assembly to archive an artifact that contains a number of symlinks, but they are all hard links.

          Do I need to specify any configuration in the descriptor to ensure that symlinks are kept?

          Show
          Ahmed El-Madhoun added a comment - Hi Zuhayr, Thanks for the fix, I am now able to build and test the patch. I am not seeing the symlinks respected. I am simply using assembly to archive an artifact that contains a number of symlinks, but they are all hard links. Do I need to specify any configuration in the descriptor to ensure that symlinks are kept?
          Hide
          Ahmed El-Madhoun added a comment -

          By the way, I am using Maven 3, but I don't think that is an issue, would it be?

          Show
          Ahmed El-Madhoun added a comment - By the way, I am using Maven 3, but I don't think that is an issue, would it be?
          Hide
          Zuhayr Khan added a comment -

          It sounds like you're hoping that the assembly plugin will look at symlinks on your file-system and include them within the assembled package?

          This use case is what the discussion on PLXCOMP-117 covers. In summary, because of the lack of system-agnostic support for symbolic links (pre Java 7?) plexus-io doesn't read/identify symlinks in this manner.

          The patch here simply allows you to configure symlinks within the assembly-definition such that they are recorded in the tar/zip file as symlinks.

          If I've understood your use case correctly, to take advantage of this, you'd need to add a "symlinks" element (see my initial comment on this) to your assembly-definition that correspond to the actual symlinks on your file system.

          Hope that helps.

          Show
          Zuhayr Khan added a comment - It sounds like you're hoping that the assembly plugin will look at symlinks on your file-system and include them within the assembled package? This use case is what the discussion on PLXCOMP-117 covers. In summary, because of the lack of system-agnostic support for symbolic links (pre Java 7?) plexus-io doesn't read/identify symlinks in this manner. The patch here simply allows you to configure symlinks within the assembly-definition such that they are recorded in the tar/zip file as symlinks. If I've understood your use case correctly, to take advantage of this, you'd need to add a "symlinks" element (see my initial comment on this) to your assembly-definition that correspond to the actual symlinks on your file system. Hope that helps.
          Hide
          Ahmed El-Madhoun added a comment -

          I kind of figured that out once I looked more into the patch and this case. I am thinking of porting assembly plugin into JDK7 with ability to automatically package symlinks, would you be interested in helping out?

          Show
          Ahmed El-Madhoun added a comment - I kind of figured that out once I looked more into the patch and this case. I am thinking of porting assembly plugin into JDK7 with ability to automatically package symlinks, would you be interested in helping out?

            People

            • Assignee:
              Unassigned
              Reporter:
              Godet Gilles
            • Votes:
              9 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated: