Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the default-value for a maven array parameter?

I have a parameter in my custom plugin that is an array. If the parameter isn't given anything, I want to set the default-value to be a blank array. Of course, here is the normal syntax for a regular variable:

/**
* @parameter default-value="Hello Maven World"
*/
private String message;

But my array is set like this:

/**
* @parameter
*/
private String[] message;

How would I set the default-value of an array variable as a parameter in a custom maven plugin?

like image 945
Rob Avery IV Avatar asked Apr 26 '13 12:04

Rob Avery IV


1 Answers

It should be possible to set the default values directly in the code instead of using a tag. This value can still be overridden in the pom file.

/**
 * @parameter
 */
private String[] message = new String[0];

That will give you an empty array.

like image 60
maba Avatar answered Oct 16 '22 22:10

maba