首页 > 解决方案 > maven post-remove 尝试删除映射文件

问题描述

我正在使用 maven 创建一个可用于安装我的应用程序的 rpm。

在我的映射中,我指定了一个目录,其中包含安装后步骤所需的文件:

            <mappings>
                <mapping>
                    <directory>${rpm.info.install_dir}</directory>
                    <filemode>700</filemode>
                    <sources>
                        <source>
                            <location>src/main/resources/install</location>
                        </source>
                    </sources>
                </mapping>
            </mappings>

在我的安装后步骤中,我使用这些文件,并在步骤结束时删除目录。结果,在删除后步骤中,我收到了多个错误,即目录中的所有文件${rpm.info.install_dir}都不存在:

Remove  1 Package

Installed size: 46 M
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Erasing    : my-app-1.0.0-SNAPSHOT.noarch                                                                                                                                                        1/1
warning: file /data/install/file1.conf: remove failed: No such file or directory
warning: file /data/install/file2.conf: remove failed: No such file or directory
warning: file /data/install/dir1/file1.service: remove failed: No such file or directory

我猜 rpm 将尝试在删除后步骤中删除规范文件 (%files) 中提到的所有文件。有什么办法可以避免这种行为?我确实想在安装后步骤之后删除安装目录,而不是等到客户决定删除 rpm。

标签: rpm-maven-plugin

解决方案


推荐阅读