Maven assembly plugin not applying fileMode on unp

2019-02-23 00:52发布

问题:

I have been banging my head against the wall all afternoon with this one. I need to create a pair of assemblies (zip and tgz) and need to set the correct executable permissions for shell scripts included in the archive.

It doesn't seem to make any difference what I do, the fileMode settings seem to have no effect. Here is a snippet from my assembly descriptor:

<dependencySet>
        <useProjectArtifact>false</useProjectArtifact>
        <useStrictFiltering>true</useStrictFiltering>
        <outputDirectory></outputDirectory>
        <unpack>true</unpack>
        <fileMode>0755</fileMode>
        <unpackOptions>
           <lineEnding>keep</lineEnding>
           <includes>
               <include>**/*.sh</include>
           </includes>
        </unpackOptions>
        <includes>
            <include>com.example:my-artifact:jar</include>
        </includes>
</dependencySet>

After untarring I do not see what I expect, e.g.

tar pxvf target/my-package-1.0.0-SNAPSHOT.tgz

I've tried with and without the p, but I still miss executable perms:

-rw-r--r--  1 MWard  staff  1468  3 Sep 09:58 a_script.sh

Any ideas as to where I may be going wrong? Thanks!

回答1:

This is a bug : https://issues.apache.org/jira/browse/MASSEMBLY-829

Solved in maven-assembly-plugin 3.0.0-SNAPSHOT