How to preserve symlinks when unpacking tar using maven assembly plugin

允我心安 提交于 2019-12-08 16:59:56

问题


I am writting a maven assembly descriptor and one of the task is to download a tar file, unpack it before creating a final tarball out of many components.

I cant figure out how to preserve symlinks from the tar using the maven assembly plugin. Has anybody seen this issue before?

<assembly>
    <id>myassembly</id>
    <formats>
            <format>dir</format>
    </formats>
    <includeBaseDirectory>false</includeBaseDirectory>
    <dependencySets>
            <dependencySet>
                    <useProjectArtifact>false</useProjectArtifact>
                    <outputDirectory>.</outputDirectory>
                    <unpack>true</unpack>
            </dependencySet>
    </dependencySets>

</assembly>

回答1:


Now everything is becoming better. I see both maven dependency plugin and assembly plugin correctly supporting symlinks. Following versions and definitions are used:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <version>2.10</version>
</plugin>
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-assembly-plugin</artifactId>
    <version>2.5.4</version>
</plugin>



回答2:


Preserving symlinks is not supported in any of the maven plugins at the momenet. I got around this problem by using the maven executor plugin that would execulte a shell script and tar and untar artifacts for me.



来源:https://stackoverflow.com/questions/17734983/how-to-preserve-symlinks-when-unpacking-tar-using-maven-assembly-plugin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!