Maven 中的可选过滤器文件

Bri*_*ett 5 build-process maven-2 build jenkins

我在 pom.xml 中配置了以下过滤器:

<build>
...
    <filters>
        <filter>build.properties</filter>
        <filter>user.properties</filter>
    </filters>
...
</build>
Run Code Online (Sandbox Code Playgroud)

build.properties包含为生产构建 web 应用程序时使用的过滤器。 user.properties是用户覆盖为build.properties本地部署和测试配置的过滤器的地方(例如,servername=localhost而不是servername=productionserver.com)。

user.properties不存储在源代码管理中,因为它对于每个开发人员来说都是本地的。当我们使用 Jenkins 构建 Web 应用程序时,它失败并显示“加载属性文件时出错”。

有没有办法将过滤器指定为可选,或者告诉 Maven 忽略缺失的过滤器?

cro*_*wne 5

查看为服务器构建和开发人员工作站构建设置不同的 Maven 构建配置文件