Maven自定义原型:有没有办法让用户不提示属性?

时间:2017-11-17 08:53:54

标签: java maven maven-archetype

所以我正在做一个原型,我想使用一些属性,但不希望它们被提示给用户。

例如,我有这段代码:

    <requiredProperty key="grupo">
        <defaultValue>${artifactId.substring(0,8).toLowerCase()}</defaultValue>
    </requiredProperty>

我想对参数grupo使用defaultValue而不要求用户接受它作为默认值。

这个问题已经被问到:Maven create archetype: Is there a way to declare properties (defaulted to a value) so as not to have them prompted?但是没有回答。

非常感谢你的时间

1 个答案:

答案 0 :(得分:0)

看来您实际上无法做到:https://maven.apache.org/archetype/archetype-models/archetype-descriptor/archetype-descriptor.html#class_requiredProperty

根据文档,您可以指定默认值或验证正则表达式。如果声明了它们,将提示您使用默认值。