Search code examples
mavenpluginsconfigurationpom.xmlmaven-bom

Plugin management with plugins inside a plugin configuration section


I have the following setup in my POM

<plugin>
    <groupId>org.jvnet.jaxb2.maven2</groupId>
    <artifactId>maven-jaxb2-plugin</artifactId>
    <configuration>
      <plugins>
        <plugin>
          <groupId>org.jvnet.jaxb2_commons</groupId>
          <artifactId>jaxb2-basics</artifactId>
        </plugin>
        <plugin>
          <groupId>org.jvnet.jaxb2_commons</groupId>
          <artifactId>jaxb2-basics-annotate</artifactId>
        </plugin>
      </plugins>
    </configuration>
</plugin>

For jaxb2-basics-annotate and jaxb2-basics I set versions in the plugin management section of an imported BOM file. However, these versions apparently do not apply, because when I compile I keep getting error message that the versions of these two plugins are not set. So, is it that plugin management sections do not work with "nested" plugins in general?


Solution

  • The plugins section in your example is inside the configuration element of the maven-jaxb2-plugin. So it's just a configuration element that happens to be called 'plugins', and not the same element as

    <build>
      <plugins>
    

    Maven itself does not validate the elements inside a plugin's configuration, as it can't know which elements are legal and not. Hence, pluginManagement is not applied here.