1

Is it architecturally feasible to construct an enforcer rule that will validate the configuration of every plugin in the effective pom?

I get that plugin configurations can't be validated before use, but to not validate them at any time in the build is unacceptable.

caduceus
  • 1,542
  • 2
  • 16
  • 21
  • What exactly do you mean by "validate"? – Gerold Broser Dec 29 '20 at 10:03
  • @GeroldBroser no tags under are checked to see that they are recognized by the plugin. So long as its valid xml I could put in nonsense and it wont complain. Not checking the value of the tag is one thing, but it should at least warn about unrecognized tags – caduceus Dec 29 '20 at 11:59
  • AFAICS tags that are not supported by a plugin are simply ignored and if there is a not supported value in a supported tag the parameter's default is used. The code completion of Eclipse's M2E plugin shows tags under `` for e.g. the `maven-jar-plugin`, idk whether this applies to all others or just some, too. So, you'd like to validate the `` tree against XSDs for the plugins you use, right? – Gerold Broser Dec 29 '20 at 15:54
  • @GeroldBroser I see, yes I would. I use atom though – caduceus Dec 30 '20 at 11:57
  • From where do you plan to get the plugins' XSDs? In https://maven.apache.org/xsd/ are only those for the Maven XMLs. – Gerold Broser Jan 01 '21 at 11:29
  • @GeroldBroser I see I've asked this question before https://stackoverflow.com/questions/61122603/how-can-i-validate-maven-pom-tags One doesn't need the XSD. The plugin's JAR file /META-INF/maven/plugin.xml can be used to determine what are correct parameters. Maybe I'll write a beanshell rule when I get the chance. See also https://stackoverflow.com/questions/40599913/how-does-plugin-validation-work-in-maven-and-why-does-it-build-my-project-with – caduceus Jan 04 '21 at 13:41
  • @GeroldBroser I would do this by unpacking every plugin JAR at the validate phase. But it should really be done by Maven when the plugin is loaded – caduceus Jan 04 '21 at 13:46

0 Answers0