Hi,
I’m writing a maven plugin with a number of configurable parameters. There are a number of parameters specified in the Mojo class. One of these parameters is required and must contain certain values (let’s say, either ‘Atwood’ or ‘Spolsky’). At the moment it is annotated with a. @required field as shows here:
public class GenerateMojo extends AbstractMojo{
...
...
/**
*@parameter
*@required
*/
private String someParameter;
...
...
}
Which is all well and good, but if someone forgets to include the parameter they get a generic error message like so:
Inside the definition for plugin 'xyz' specify the following:
<configuration>
...
<someParameter>VALUE</someParameter>
</configuration>
If is possible to either (1) restrict the values that can be inputted to the someParmeter field to give a better error message, or (2) specify the error message myself so that I can write something like “The value for ‘someParameter’ needs to be either ‘Atwood’ or ‘Spolsky’ ??
Thanks