I am new to Maven and doing a lot of learning about Parent pom inheritance. 
When I first set things up, I put the common plugins in the parent pom under 
the plugingManagement tags and things are working fine (with no plugins in the 
child poms)

But in my research of all things maven I came across a few learnings that say 
the way I have things setup should not work. From what I can tell and from the 
Maven learning page, even if you use pluginManagment to put your plugins at the 
parent POM, you still need to reference those plugins from the child pom.
Plugin Management
?  pluginManagement: is an element that is seen along side plugins. Plugin 
Management contains plugin elements in much the same way, except that rather 
than configuring plugin information for this particular project build, it is 
intended to configure project builds that inherit from this one. However, this 
only configures plugins that are actually referenced within the plugins element 
in the children or in the current POM. The children have every right to 
override pluginManagement definitions.
https://maven.apache.org/pom.html#Plugin_Management


But with my experience,  the plugins defined in the parent pom are getting used 
without any declaration in the child, I even changed versions in the parent to 
confirm I was not just getting default plugin versions.  What am I missing? 
Have things changed? I did think it odd that you could not inherit plugins like 
everything else you can.

Note: I am not using any configurations, just simple plugin reference in parent 
pom:
build>
    <pluginManagement
      <plugins>
        <plugin>
          <artifactId>maven-clean-plugin</artifactId>
          <version>3.1.0</version>
        </plugin>
        <plugin>
          <artifactId>maven-resources-plugin</artifactId>
          <version>3.1.0</version>
        </plugin>
        <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.8.1</version>
        </plugin>
        <plugin>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>3.0.0-M4</version>
        </plugin>
        <plugin>
          <artifactId>maven-jar-plugin</artifactId>
          <version>3.2.0</version>
        </plugin>
        <plugin>
          <artifactId>maven-install-plugin</artifactId>
          <version>3.0.0-M1</version>
        </plugin>
        <plugin>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>3.0.0-M1</version>
        </plugin>
        <plugin>
          <artifactId>maven-site-plugin</artifactId>
          <version>3.7.1</version>
        </plugin>
        <plugin>
          <artifactId>maven-project-info-reports-plugin</artifactId>
          <version>3.0.0</version>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>


Reply via email to