19

同様の質問:タスクが他のプラットフォームで使用されている場合でも、AntのtarタスクはLinuxファイルのアクセス許可を設定できますか?

'project'記述子でMaven2アセンブリプラグインを使用する場合、たとえば含まれているbuild.shスクリプトファイルのシェルスクリプト権限を実行可能ファイルに設定する方法はありますか?

例:

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

これにより、3つのファイルが作成されます

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

そして、tarファイルにあるすべての*.shファイルのファイルパーミッションを「実行可能」に設定したいと思います。

4

2 に答える 2

51

これはfileMode、Mavenアセンブリプラグインアセンブリ記述子で使用可能なパラメーターを使用して実行できます。例えば

<assembly>
    ...
    <fileSets>
        <fileSet>
            <directory>${project.build.directory}/bin</directory>
            <outputDirectory>/bin</outputDirectory>
            <includes>
                <include>*.sh</include>
            </includes>
            <fileMode>0755</fileMode>
        </fileSet>
        ...
    </fileSets>
    ...
</assembly>
于 2011-01-18T02:37:57.720 に答える
4

コメントで、ディレクトリに権限を設定して、最終的に権限が付与されないようにする方法を尋ねられましたd---------。答えは非常に簡単です-使用directoryMode

<assembly>
    ...
    <fileSets>
        <fileSet>
            <directory>${project.build.directory}/bin</directory>
            <outputDirectory>/bin</outputDirectory>
            <includes>
                <include>*.sh</include>
            </includes>
            <fileMode>0755</fileMode>
            <directoryMode>0755</directoryMode>
        </fileSet>
        ...
    </fileSets>
    ...
</assembly>
于 2019-03-29T11:45:24.197 に答える