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 > > http://svn.codehaus.org/cargo/extensions/trunk/maven2/plugin/src/main/java/org/codehaus/cargo/maven2/AbstractCargoMojo.java > 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 > http://ali.tokmen.com/ > > My IM, GSM, PGP and other contact details > are on http://contact.ali.tokmen.com > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] <javascript:;> > For additional commands, e-mail: [email protected]<javascript:;> > > -- Sent from my phone
