You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Robert Patrick <ro...@oracle.com> on 2014/02/02 20:18:39 UTC
RE: Plugins with parameters and defaultValue
>From what I can tell in my testing, the @Parameter attributes required=true and defaultValue="some value" are mutually exclusive (in terms of behavior). That is, if you combine defaultValue="..." and required=true, defaultValue always satisfies the required=true setting, making required=true irrelevant.
If a defaultValue is provided (regardless of whether or not required=true is set or not), you will get the default value injected in the following configurations specified for the parameter myValue:
- <myValue> </myValue>
- <myValue></myValue>
- <myValue/>
- myValue not specified in the configuration
If required=true is specified without a defaultValue specified, the same for cases above will cause build failures because the required parameter has not been specified.
--
Robert Patrick <ro...@oracle.com>
VP, FMW Platform Architecture
Oracle Corporation Office: +1.940.725.0011
1148 Triple Crown Court Fax: +1.940.725.0012
Bartonville, TX 76226, USA Mobile: +1.469.556.9450
Professional Oracle WebLogic Server
by Robert Patrick, Gregory Nyberg, and Philip Aston
with Josh Bregman and Paul Done
Book Home Page: http://www.wrox.com/
Kindle Version: http://www.amazon.com/
-----Original Message-----
From: Karl Heinz Marbaise [mailto:khmarbaise@gmx.de]
Sent: Thursday, January 30, 2014 12:23 PM
To: dev@maven.apache.org
Subject: Plugins with parameters and defaultValue
Hi,
just a question concerning the usage of default values in a mojo...
If i define a default value for a parameter in a Mojo like the following:
@Parameter( defaultValue = "${project.build.finalName}", required = true ) private String finalName;
So the question is:
Can i see the difference in the mojo code if someone in the pom file has
written:
<finalName/>
or
just omit it.
or is this not possible ?
In my opinion it's not possible to distinguish between those two cases.
Any ideas ?
Thanks in advance.
Kind regards
Karl Heinz Marbaise
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org For additional commands, e-mail: dev-help@maven.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org