Maven assembly builds chmod output folder

I am trying to use the maven-assembly plugin in such a way as to create the zip of my JAR project and all the libraries needed to run it:

        <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.2.1</version>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <descriptors>
<descriptor>src/main/assembly/exportWithDepends.xml</descriptor>
                            </descriptors>
                            <finalName>myname</finalName>
                            <appendAssemblyId>false</appendAssemblyId>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

My assembly looks like this:

<assembly>
    <id>jar-with-dependencies</id>
    <formats>
        <format>zip</format>
    </formats>
    <includeBaseDirectory>false</includeBaseDirectory>
    <dependencySets>
        <dependencySet>
            <unpack>false</unpack>
            <scope>runtime</scope>
            <outputDirectory>lib</outputDirectory>
            <useProjectArtifact>true</useProjectArtifact>
            <fileMode>755</fileMode>
        </dependencySet>
    </dependencySets>
    <files>
        <file>  
<source>${project.build.directory}/${project.build.finalName}.jar</source>
        </file>
    </files>
</assembly>

This works and makes the correct zip.

Then the fileMode flag in the dependencySet file gives each element within the LIB 755 CHMOD. The problem is that the LIB folder itself remains 777. Is there a way to make the LIB folder also accessible to 755?

Make maven do what he doesn’t want to do, always upsets me :(

+3
source share
3 answers

I don't think maven-assembly-plugin can do it right now. So I just made changes to the bash script ...

+1
source

, pom.xml 0755 . , , (), , , maven Unix, , .

        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.3</version>
            <configuration>
                <archiverConfig>
                    <!-- 493D == 0755, seems to be assembly plugin bug -->
                    <defaultDirectoryMode>493</defaultDirectoryMode>
                </archiverConfig>
            </configuration>

: https://issues.apache.org/jira/browse/MASSEMBLY-494

+7

I haven’t tried it myself, so I can’t say if it works with the target directory or only the directories added to the target directory, but you really should try

 <directoryMode>755</directoryMode>

in docs

+4
source

All Articles