基于多个文件存在的Maven配置文件激活 [英] maven profile activation based on existence of several files

查看:110
本文介绍了基于多个文件存在的Maven配置文件激活的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想根据几个文件的存在来激活配置文件.在下面的示例中,如果文件my.markeranother.marker同时存在,我希望激活配置文件.

I would like to activate a profile based on the existence of several files. In the following example I want the profile to be activated if both files my.marker and another.marker exists.

    <activation>
        <file>
            <exists>${basedir}/my.marker</exists>
            <exists>${basedir}/another.marker</exists>
        </file>
    </activation>

它对架构无效,因此无效.有没有不用命令行属性就可以做这种事情的方法?

It does not work since it's not valid against the schema. Is there a way to do such a thing without using command line properties?

推荐答案

实际上,即使在Maven 3.2.2中解决了MNG-4565的情况,仍然无法检查是否存在多个文件.这是因为POM模型不允许多个file或多个exists元素( https://issues.apache.org/jira/browse/MNG-5909 ).即使将existsmissing混合到一个file元素中也不起作用(因为如果存在exists元素,则仅将其考虑在内,并且将忽略同级的missing元素,

Actually even with MNG-4565 being solved in Maven 3.2.2 it is still not possible to check for the existence of several files. That is because the POM model doesn't allow multiple file nor multiple exists elements (https://issues.apache.org/jira/browse/MNG-5909). Even mixing exists and missing in one file element does not work (because if the exists element is there, it will be considered only and the sibling missing element will be disregarded, https://issues.apache.org/jira/browse/MNG-5910)

这篇关于基于多个文件存在的Maven配置文件激活的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆