maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Connolly <>
Subject Re: Maven2/Maven3 plugin development: Ensuring only the available parameters are allowed
Date Wed, 08 Jan 2014 19:12:23 GMT
There are valid reasons why a configuration having "invalid" elements may
be "valid".

Consider the case where
xpath:/project/build/pluginManagement/plugins/plugin/version specifies the
*default* version and xpath:/project/build/plugins/plugin/version is
absent... In this case xpath:/project/build/plugins/plugin/configuration
applies to any version of the plugin, so somebody invoking a specific
version of the plugin directly would/should get that configuration... Thus
an element that does not make sense to the executing version of the plugin
*may* make sense to a future/older version if the plugin... Hence failing
because of unknown parameters would be a "bad thing"

You could request the dom node yourself and parse it by hand if you want to
issue warning though

On Tuesday, 7 January 2014, S. Ali Tokmen wrote:

> Dear Maven users
> I am one of the owners of Codehaus CARGO, which has a Maven2/Maven3
> plugin; and would have a question with regards to how parameters are
> managed.
> We defined our MOJOs with parameters (you can see
> for example), but what happens is that if a user unwillingly puts a
> parameter in the wrong place then the plugin execution doesn't stop.
> As an example, I can write the below POM and build still works (even
> thought the MOJO has no parameter called "foo"):
>   <plugin>
>     <groupId>org.codehaus.cargo</groupId>
>     <artifactId>cargo-maven2-plugin</artifactId>
>     <version>1.4.6</version>
>     <configuration>
>       <foo>
>         bar
>       </foo>
>     </configuration>
>   </plugin>
> Is there any way I can instruct by MOJO to fail if there is an unknown
> parameter?
> Please advise
> Thank you
> --
> S. Ali Tokmen
> My IM, GSM, PGP and other contact details
> are on
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: <javascript:;>
> For additional commands, e-mail:<javascript:;>

Sent from my phone

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message