即使在其他平台上运行,也可以使用Maven程序集插件设置Linux文件权限吗? [英] Use Maven assembly plugin to set Linux file permissions even when run on other platforms?

查看:96
本文介绍了即使在其他平台上运行,也可以使用Maven程序集插件设置Linux文件权限吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

类似的问题:如果我将Maven 2程序集插件与'project'描述符一起使用,是否可以将Shell脚本权限设置为可执行文件,例如包含的build.sh脚本文件?

If I use Maven 2 assembly plugin with the 'project' descriptor, is there a way to set shell script permissions to executable for example for included build.sh script files?

示例:

        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.2</version>
            <configuration>
                <descriptorRefs>
                    <descriptorRef>project</descriptorRef>
                </descriptorRefs>
            </configuration>
        </plugin>

这将创建三个文件

  • -project.tar.bz2
  • -project.tar.gz
  • -project-zip

我想将tar文件中所有* .sh文件的文件权限设置为可执行".

And I would like to set the file permissions for all *.sh files which are in the tar files to 'executable'.

推荐答案

可以使用Maven组件插件fileMode参数来完成此操作. -assembly-plugin/assembly.html"rel =" noreferrer>组装描述符.例如

This can be done using the fileMode parameter available in Maven Assembly Plugin assembly descriptor. For instance

<assembly>
    ...
    <fileSets>
        <fileSet>
            <directory>${project.build.directory}/bin</directory>
            <outputDirectory>/bin</outputDirectory>
            <includes>
                <include>*.sh</include>
            </includes>
            <fileMode>0755</fileMode>
        </fileSet>
        ...
    </fileSets>
    ...
</assembly>

这篇关于即使在其他平台上运行,也可以使用Maven程序集插件设置Linux文件权限吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆