admin管理员组文章数量:1302272
I have found in my codebase a maven mojo which declares a parameter like this:
@Parameter(defaultValue = "myDefaultValue", required = true)
public String myValue;
Does the option "required = true" has any effect in this mojo? The documentation says:
true
if the Mojo should fail when the parameter cannot be injected
Is there a scenario where the user can prevent the parameter from being injected, and the "required = true" ensures me a "fail fast" mechanism? Or is the defaultValue guaranteed to always be used if the parameter is missing, making the "required = true" redundant?
本文标签: Does using a defaultValue and requiredtrue in a Maven mojo make senseStack Overflow
版权声明:本文标题:Does using a defaultValue and required = true in a Maven mojo make sense? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741663637a2391179.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论