[ 
https://issues.apache.org/jira/browse/MSHADE-290?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16560625#comment-16560625
 ] 

Behrang Saeedzadeh commented on MSHADE-290:
-------------------------------------------

Hi Karl,

The shell script was used just as an example to reproduce the issue. In 
practice, in my case, I had to bundle executable binaries in my JAR file. 

In particular, AWS Lambda supports ZIP or JAR files as its deployment units: 
[https://docs.aws.amazon.com/lambda/latest/dg/java-create-jar-pkg-maven-no-ide.html].

Some Java apps require additional "native" binaries to work (e.g. the 
[GraphViz|https://www.graphviz.org/] 
[dot|https://gitlab.com/graphviz/graphviz/tree/master/cmd/dot] binary is needed 
by PlantUML to work properly).

When deployed, the AWS runtime extracts the contents of the JAR file into a 
read-only file system and for the binaries to work, it expects the executable 
bit to bet set on them.

Gradle handles this with no problem – it will preserve the file attributes when 
it is used as explained 
[here|https://docs.aws.amazon.com/lambda/latest/dg/create-deployment-pkg-zip-java.html].
 But the Maven Shade plugin is not preserving these file attributes. 
Consequently, when an attempt is made to execute the binary using 
[java.lang.ProcessBuilder|https://docs.oracle.com/javase/8/docs/api/java/lang/ProcessBuilder.html],
 it fails with an exception. If the Maven Shade Plugin preserved the 
permissions, the AWS Lambda Java code could successfully execute the bundled 
binaries.

Cheers.

> Maven Shade Plugin does not preserve the unix file permission of resources
> --------------------------------------------------------------------------
>
>                 Key: MSHADE-290
>                 URL: https://issues.apache.org/jira/browse/MSHADE-290
>             Project: Maven Shade Plugin
>          Issue Type: Bug
>    Affects Versions: 3.1.1
>         Environment: * Linux 4.15.0-23-generic GNU/Linux (Ubuntu 18.04)
> * OpenJDK Runtime Environment (build 1.8.0_171-8u171-b11-0ubuntu0.18.04.1-b11)
> * Apache Maven 3.5.2
>            Reporter: Behrang Saeedzadeh
>            Priority: Major
>         Attachments: bug-report.zip
>
>
> A sample project to reproduce this is attached.
> Here are the steps to reproduce:
>  # Extract the archive and CD into the project directory
>  # run {{mvn clean package}}
>  # {{cd target}}
>  # Run {{unzip original-maven-shade-plugin-file-permissions-1.0-SNAPSHOT.jar 
> -d original}}
>  # Run {{unzip maven-shade-plugin-file-permissions-1.0-SNAPSHOT.jar -d 
> shaded}}
> If you check the permission of the {{script.sh}} file in the {{original}} 
> folder, it is 755:
> {code:java}
> $ ls -alh original/script.sh 13:54:34
> -rwxrwxr-x 1 24 Jun 17 13:52 original/script.sh*{code}
> However the permissions are changed in the files extracted in the {{shaded}} 
> directory:
> {code:java}
> $ ls -alh shaded/script.sh 13:54:37
> -rw-rw-r-- 1 24 Jun 17 13:52 shaded/script.sh{code}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to