Reputation: 3730
I have a plugin that I'm creating and it has a parameter like so:
/**
* Global variable as maven plugin parameter
* @parameter expression="${plugin.var}" default-value=OtherClass.GLOBAL_VAR
*/
private int var;
I have another class called OtherClass
that has a public final static int GLOBAL_VAR;
.
How would I be able to set the default-value from a variable from the actual plugin software?
Upvotes: 1
Views: 97
Reputation: 5265
You can just omit the declaration of a default value and assign OtherClass.GLOBAL_VAR
directly to var
:
/**
* Global variable as maven plugin parameter
* @parameter expression="${plugin.var}"
*/
private int var = OtherClass.GLOBAL_VAR;
As long as ${plugin.var}
is not defined, var
will not change its value.
Upvotes: 2