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