rpm-maven-plugin不适用于多个softlinkSource

时间:2018-07-17 15:23:22

标签: maven symlink rpm-maven-plugin

我正在尝试在映射中使用softlinkSource在通过maven(rpm-maven-plugin)生成的rpm中添加多个软链接,但无法正常工作。

这是映射代码段:

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<version>2.2.0</version>
<extensions>true</extensions>
<executions>
    <execution>
        <id>build-default</id>
        <goals>
            <goal>attached-rpm</goal>
        </goals>
        <configuration>
            <name>project1-webapp</name>
            <classifier>default</classifier>
            <defaultDirmode>755</defaultDirmode>
            <defaultFilemode>644</defaultFilemode>
            <defaultUsername>apache</defaultUsername>
            <defaultGroupname>apache</defaultGroupname>
            <mappings>
                <mapping>
                    <directory>/var/www/html/project1</directory>
                    <sources>
                        <softlinkSource>
                            <destination>linkName1</destination>
                            <location>/var/www/html/project1/target1</location>
                        </softlinkSource>
                        <softlinkSource>
                            <destination>linkName2</destination> 
                            <location>/var/www/html/project1/target2</location>
                        </softlinkSource>
                    </sources>
                </mapping>
             ...

target1和target2是目录。 我收到类似rpm-maven-plugin尝试为目录中的每个文件创建软链接的错误消息:

[INFO] + mkdir /tmp/project1-webapp-1.1829.0-SNAPSHOT/target/rpm/project1-webapp-default/buildroot
[INFO] + LANG=C
[INFO] + export LANG
[INFO] + unset DISPLAY
[INFO] + '[' -d /tmp/project1-webapp-1.1829.0-SNAPSHOT/target/rpm/project1-webapp-default/buildroot ']'
[INFO] + mv /tmp/project1-webapp-1.1829.0-SNAPSHOT/target/rpm/project1-webapp-default/tmp-buildroot/var /tmp/project1-webapp-1.1829.0-SNAPSHOT/target/rpm/project1-webapp-default/buildroot
[INFO] + ln -s /var/www/html/project1/target1/file1.php /tmp/project1-webapp-1.1829.0-SNAPSHOT/target/rpm/project1-webapp-default/buildroot/var/www/html/project1/file1.php
[INFO] + ln -s /var/www/html/project1/target1/file2.php /tmp/project1-webapp-1.1829.0-SNAPSHOT/target/rpm/project1-webapp-default/buildroot/var/www/html/project1/file2.php
[INFO] ln: creating symbolic link `/tmp/project1-webapp-1.1829.0-SNAPSHOT/target/rpm/project1-webapp-default/buildroot/var/www/html/project1/file2.php': No such file or directory
[INFO]
[INFO]
[INFO] RPM build errors:
[INFO] error: Bad exit status from /var/tmp/rpm-tmp.vIViF0 (%install)
[INFO]     Bad exit status from /var/tmp/rpm-tmp.vIViF0 (%install)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
...                 

我单独尝试过第一个softlinkSource,它可以工作。 仅第二个软链接也可以使用。 但是在一起却不起作用。 我也尝试过拆分为不同的映射,但是却遇到了相同的错误。

所以..是否可以通过rpm-maven-plugin添加多个软链接?

我现在使用的解决方法是在安装后脚本中创建这些软链接...

0 个答案:

没有答案