码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2017-05-05 23:22:01      阅读:584      评论:0      收藏:0      [点我收藏+]

标签:epo   apache   artifact   example   ssi   freebsd   rect   includes   执行   

 

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

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

fileMode String Similar 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>

 

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

标签:epo   apache   artifact   example   ssi   freebsd   rect   includes   执行   

原文地址:http://www.cnblogs.com/jackjun/p/6814972.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!