Maven Dependency Plugin
  1. Maven Dependency Plugin
  2. MDEP-109

Dependency plugin looses file permissions when unpacking or copying artifact items

    Details

    • Number of attachments :
      0

      Description

      I have to add the following ugly config in my pom.xml to overcome this:

            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-antrun-plugin</artifactId>
              <executions>
                <execution>
                  <phase>prepare-package</phase>
                  <goals>
                    <goal>run</goal>
                  </goals>
                  <configuration>
                    <tasks>
                      <!-- Dependency plugin discards file permissions so we need to set them back manually -->
                      <chmod file="${project.build.directory}/dependency/bin/windres" perm="ugo+rx"/>
                      <chmod file="${project.build.directory}/dependency/bin/ld" perm="ugo+rx"/>
      ...
      

        Activity

        Hide
        Gili added a comment -

        Brian,

        You can use the Apache Commons Compress library to add support for file permissions.

        Show
        Gili added a comment - Brian, You can use the Apache Commons Compress library to add support for file permissions.
        Hide
        Tim Moore added a comment -

        I think this is fixed in version 2.5.

        Show
        Tim Moore added a comment - I think this is fixed in version 2.5.
        Hide
        Gili added a comment -

        Tim,

        Last I checked bugs don't magically fix themselves

        Someone needs to confirm they can reproduce the bug before 2.5 but not after it. For all we know, your testcase could be flawed in some way.

        Show
        Gili added a comment - Tim, Last I checked bugs don't magically fix themselves Someone needs to confirm they can reproduce the bug before 2.5 but not after it. For all we know, your testcase could be flawed in some way.
        Hide
        Tim Moore added a comment -

        It isn't magical, the dependency on plexus-archiver was updated to a version that runs chmod on each file it unpacks. I discovered this because it caused a massive performance regression in our builds! (I'll file a bug report with a patch for that on Monday.)

        I don't have an actual test case, I was more intending to prompt the original reporter to give it a try with 2.5.

        Show
        Tim Moore added a comment - It isn't magical, the dependency on plexus-archiver was updated to a version that runs chmod on each file it unpacks. I discovered this because it caused a massive performance regression in our builds! (I'll file a bug report with a patch for that on Monday.) I don't have an actual test case, I was more intending to prompt the original reporter to give it a try with 2.5.
        Hide
        Vincent Massol added a comment -

        Hi Tim,

        Thanks for pinging me. I've tested it an you're right, version 2.5 fixes the problem!

        Thanks again

        PS: I'll let you close the issue since I don't know if you want to close it as duplicate of the real issue that fixed the issue or not.

        Show
        Vincent Massol added a comment - Hi Tim, Thanks for pinging me. I've tested it an you're right, version 2.5 fixes the problem! Thanks again PS: I'll let you close the issue since I don't know if you want to close it as duplicate of the real issue that fixed the issue or not.
        Hide
        Tim Moore added a comment -

        Great, Vincent. I'm not actually a committer, so I don't have any permission to close the issue. This is just something we happened to notice in our own use of the Maven Dependency Plugin.

        The actual change is here: http://svn.apache.org/viewvc?view=revision&revision=1292983

        There's no JIRA issue key referenced in the commit message, so maybe there is no duplicate issue.

        Show
        Tim Moore added a comment - Great, Vincent. I'm not actually a committer, so I don't have any permission to close the issue. This is just something we happened to notice in our own use of the Maven Dependency Plugin. The actual change is here: http://svn.apache.org/viewvc?view=revision&revision=1292983 There's no JIRA issue key referenced in the commit message, so maybe there is no duplicate issue.
        Hide
        Vincent Massol added a comment -

        ok Thanks Tim. I'll let a committer close it.

        Show
        Vincent Massol added a comment - ok Thanks Tim. I'll let a committer close it.
        Hide
        Leonid Ilyevsky added a comment -

        This problem is still there. More specifically, when unpacking tar.gz on linux, and the files have specific permissions for the group in the archive, they are incorrect after the unpack.
        I believe, the reason is that java.io.File class does not support Posix style permissions, and obviously this is what is used in the dependency plugin.
        There are two ways of fixing it.
        First way is to use java.nio.file.attribute package that supports Posix permissions, but this is available only since Java 7, and so this fix will not work with Java 6. I personally would prefer this solution; we all will start using Java 7 anyway at some point.
        Another way is to call tar utility from inside the plugin, instead of pure clean Java solution.

        Show
        Leonid Ilyevsky added a comment - This problem is still there. More specifically, when unpacking tar.gz on linux, and the files have specific permissions for the group in the archive, they are incorrect after the unpack. I believe, the reason is that java.io.File class does not support Posix style permissions, and obviously this is what is used in the dependency plugin. There are two ways of fixing it. First way is to use java.nio.file.attribute package that supports Posix permissions, but this is available only since Java 7, and so this fix will not work with Java 6. I personally would prefer this solution; we all will start using Java 7 anyway at some point. Another way is to call tar utility from inside the plugin, instead of pure clean Java solution.

          People

          • Assignee:
            Unassigned
            Reporter:
            Vincent Massol
          • Votes:
            13 Vote for this issue
            Watchers:
            13 Start watching this issue

            Dates

            • Created:
              Updated: