【问题标题】:Set executable file permission using maven assembly使用maven程序集设置可执行文件权限
【发布时间】:2018-05-13 15:48:39
【问题描述】:

我怎么说给位于 {project.basedir}/src/deb/init 下的 shell 脚本提供可执行权限。我不想将它们打包到不同的文件夹或任何东西,但我只想授予该文件的可执行权限。我在下面添加了,但是当我提取 debian 并检查文件权限时,它仍然如下所示,

-rw-r--r-- 1 myuser ms-media.sh

这个汇编文件是否正确?我在这里错过了什么?

<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
  <id/> 
  <fileSets>
    <fileSet>
      <useDefaultExcludes/>
      <includes><include>*.sh</include></includes>
      <excludes/>
      <fileMode>0755</fileMode>
      <directoryMode/>
      <directory>${project.basedir}/src/deb/init</directory>
      <lineEnding/>
      <filtered/>
    </fileSet>
  </fileSets>
</assembly>

我的 pom.xml 中有这个。 default.xml 也与 pom.xml 处于同一级别

             <plugin>
                <!-- Assembly Plugin for the win! -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <descriptors>
                        <descriptor>default.xml</descriptor>
                    </descriptors>
                </configuration>
                <executions>
                    <execution>
                        <id>assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

【问题讨论】:

  • 首先我建议将您的 maven-assembly-plugin 升级到最新版本,请参见此处:maven.apache.org/plugins/maven-assembly-plugin
  • @khmarbaise 我已将其升级到 3.1.0,但随后出现错误。我也删除了版本标签并尝试使用 2.5.1 Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.5.1:single (assembly) on project: No formats specified in the execution parameters or the程序集描述符。 issues.apache.org/jira/browse/FALCON-1898 之前我只运行了 mvn clean package 命令。我是否必须执行不同的 Maven 命令?
  • 我的情况应该采用什么格式?
  • 因为错误消息表明您必须定义 zip、tar、tar.gz 等格式,当然您应该定义 &lt;id&gt;..&lt;/id&gt;...

标签: java maven debian ubuntu-16.04 maven-assembly-plugin


【解决方案1】:

只为未来的读者:我也在寻找解决方案并遇到了这个问题。多年后,更新问题不适用于我。上面的例子已经足够了。

我必须添加到我的程序集文件中的是

<fileMode>0755</fileMode>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-11-04
    • 2016-04-13
    • 2013-09-09
    • 2011-06-10
    • 2016-08-20
    • 2014-12-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多