Re: How to list config parameter names in MOJO used by a plugin in POM?

2019-04-05 Thread Robert Scholte

@Parameter( defaultValue = "${mojoExecution}", readonly = true )
private MojoExecution mojo;

private void verifyRemovedParameter( String paramName )
{
Xpp3Dom configDom = mojo.getConfiguration();
if ( configDom != null )
{
if ( configDom.getChild( paramName ) != null )
{
throw new IllegalArgumentException( "parameter '" +  
paramName
+ "' has been removed from the plugin, please verify  
documentation." );

}
}
}

private void verifyReplacedParameter( String oldParamName, String  
newParamNew )

{
Xpp3Dom configDom = mojo.getConfiguration();
if ( configDom != null )
{
if ( configDom.getChild( oldParamName ) != null )
{
throw new IllegalArgumentException( "parameter '" +  
oldParamName
+ "' has been replaced with " + newParamNew + ",  
please verify documentation." );

}
}
}

On Fri, 05 Apr 2019 17:37:41 +0200, Tibor Digana   
wrote:



I want to observe a list of config parameters (names) in MOJO plugin
without injecting @Param for each.

If the customer still uses old parameter, the MOJO wouldn't know it.
Therefore I want to read the list of paramaters. And if he stil uses the
old name, the plugin would fail with a hint saying how to fix this  
problem.


Is this possible in MOJO?

Thx
Tibor


-
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org



How to list config parameter names in MOJO used by a plugin in POM?

2019-04-05 Thread Tibor Digana
I want to observe a list of config parameters (names) in MOJO plugin
without injecting @Param for each.

If the customer still uses old parameter, the MOJO wouldn't know it.
Therefore I want to read the list of paramaters. And if he stil uses the
old name, the plugin would fail with a hint saying how to fix this problem.

Is this possible in MOJO?

Thx
Tibor