question --> maven assembly plugin 修改文件默认权限

 

使用maven assembly plugin插件添加执行脚本时,发现默认权限为644,还需要手动添加执行权限。这很麻烦,于是查看文档

官方文档 http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html#class_fileSet

fileModeStringSimilar to a UNIX permission, sets the file mode of the files included. THIS IS AN OCTAL VALUE. Format: (User)(Group)(Other) where each component is a sum of Read = 4, Write = 2, and Execute = 1. For example, the value 0644 translates to User read-write, Group and Other read-only. The default value is 0644. (more on unix-style permissions)

可知道默认文件权限为0644,所以调整权限0744即可。

 1 <assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
 2           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 3           xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
 4     <id></id>
 5     <formats>
 6         <format>dir</format>
 7         <format>tar.gz</format>
 8     </formats>
 9     <includeBaseDirectory>false</includeBaseDirectory>
10     <fileSets>
11         <fileSet>
12             <directory>target/classes</directory>
13             <includes>
14                 <include>**/*.*</include>
15             </includes>
16             <outputDirectory>gpay-report/classes</outputDirectory>
17         </fileSet>
18 
19         <fileSet>
20             <directory>../</directory>
21             <includes>
22                 <include>start.sh</include>
23             </includes>
24             <!--修改文件默认权限0644,需要有执行权限-->
25             <fileMode>0744</fileMode>
26             <outputDirectory>gpay-report</outputDirectory>
27         </fileSet>
28     </fileSets>
29 
30     <dependencySets>
31         <dependencySet>
32             <useProjectArtifact>false</useProjectArtifact>
33             <outputDirectory>gpay-report/lib</outputDirectory>
34             <scope>runtime</scope>
35         </dependencySet>
36     </dependencySets>
37 </assembly>

 

转载于:https://www.cnblogs.com/jackjun/p/6814972.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值