Issue Details (XML | Word | Printable)

Key: MASSEMBLY-337
Type: Bug Bug
Status: Open Open
Priority: Blocker Blocker
Assignee: Unassigned
Reporter: John Crim
Votes: 9
Watchers: 7
Operations

If you were logged in you would be able to see more operations.
Maven 2.x Assembly Plugin

dependencySet with unpack=true cannot be used to make file permissions executable

Created: 03/Jul/08 07:23 PM   Updated: 28/Aug/09 03:16 AM
Component/s: None
Affects Version/s: 2.2-beta-2
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments: 1. GZip Archive massembly-bug.tar.gz (1 kB)

Environment: Maven 2.0.9, Java 1.6_04, tested on both Windows XP and CentOS 4.1
Issue Links:
dependent
 

Testcase included: yes


 Description  « Hide

The attached tar.gz contains 2 simple test projects which exhibit this bug:

  1. Project scripts-assembly generates scripts-assembly-1.0-SNAPSHOT-scripts.zip, which contains a single file, script.sh, with permissions -rwxr-xr-x
  2. Project assembly-filemode-bug depends on project scripts-assembly. It extracts the scripts.zip file into its /bin directory when creating its assembly.
<!-- Assembly descriptor for assembly-filemode-bug project -->
  <dependencySets>

    <dependencySet>
      <outputFileNameMapping></outputFileNameMapping>
      <outputDirectory>bin</outputDirectory>
      <unpack>true</unpack>
      <includes>
        <include>maven-bugs:scripts-assembly:zip:scripts</include>
      </includes>
      <fileMode>0755</fileMode>
    </dependencySet>

  </dependencySets>

The fileMode element does not have the desired effect. I'm not able to find a workaround with 2.2-beta-2 that enables me to set the executable bit on the scripts. From looking at other bugs in MASSEMBLY, I did try configuring the scripts-assembly project to output a zip (also tried tar.gz) containing the files with the executable bit set. This didn't change the outcome - the files in package #2 are still not executable.

I consider this a highest priority bug, b/c I can find no way to get around this limitation and make script files from a dependency executable within an installable package. If I change to assembly plugin version 2.2-beta-1 (which admittedly has a significant list of bugs I'd like to avoid), this works. I've also tried using other tar.gz for the assembly output of both projects, but it didn't affect the outcome.

At this point I think my best path forward is to use assembly plugin version 2.2-beta-1.



Kallin Nagelberg added a comment - 03/Sep/08 03:21 PM

I've encountered the same problem when trying to use <fileMode>0700</fileMode> . It appears to disregard that tag entirely when used within a dependencyset.


Anders Blaagaard added a comment - 08/Jul/09 03:28 AM

I have the same problem, but managed to make a workaround by first unpacking the dependency using the unpack goal in the dependency plugin, and then including it in the assembly as a fileSet with correct fileMode settings.


Mark Bowman added a comment - 27/Aug/09 06:18 AM

Anders,

This bug is a killer.
Would you mind posting some details of your workaround. I understand the fileSet in the assembly but I'm not clear how to use the dependency plugin.


Anders Blaagaard added a comment - 28/Aug/09 03:03 AM

Here is a more detailed description of the work-around I use.

In the build/plugins part of the pom.xml I use the dependency plugin to unpack the zip file somewhere:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-dependency-plugin</artifactId>
  <executions>
    <execution>
      <id>unpack</id>
      <goals>
        <goal>unpack</goal>
      </goals>
      <configuration>
        <artifactItems>
          <artifactItem>
            <groupId>...</groupId>
            <artifactId>...</artifactId>
            <version>...</version>
            <type>zip</type>
            <outputDirectory>target/UNPACKEDZIP</outputDirectory>
          </artifactItem>
        </artifactItems>
      </configuration>
    </execution>
  </executions>
</plugin>

I then use the fileSet instead of the dependencySet in the assembly:

<fileSets>
  <fileSet>
    <directory>target/UNPACKEDZIP</directory>
    <outputDirectory>bin</outputDirectory>
    <fileMode>0755</fileMode>
  </fileSet>
</fileSets>

Mark Bowman added a comment - 28/Aug/09 03:08 AM

Anders,

Thanks for the detail. Makes sense. Have you noticed any long delays in the maven-dependency-plugin? It seems to finish doing the unpacking and then sit for 4 minutes before handing onto the next plugin. You can even remove the files it claims to be working on and it continues to sit.


Anders Blaagaard added a comment - 28/Aug/09 03:16 AM

No, I don't see any delays here