I'm writing a Maven plugin and I am using default values for all parameters such as this:
/**
* The file with the site structure.
*
* @parameter expression="${generateSite.siteFile}" default-value="${basedir}/src/oda/site.xml"
*/
private File siteFile;
Now I am adding a new parameter which is a collection. Is there a way to set default values for a parameter like the following one?
/**
* A list of file/directory names to exclude in the processing.
*
* @parameter ????
*/
private Set<String> excludes;
To my knowledge, this is actually not possible, there is no real way to specify default values for Parameter Types With Multiple Values (like Arrays, Collections, or Maps), at least not as
parameter
. I had to do this in the past too and, having read threads like array (or collecton) as a default-value of a mojo configuration parameter or configuring a list as default value for a plugin parameter, I ended up setting defaults in theexecute()
method, like Chris mentioned in a comment to his answer (see for example the flexmojos:wrapper plugin sources and the parameters parameter).