Effective POM in Maven based Java Project

First of all, to get started with this topic we need to understand what maven is?

  •     Maven is a tool that can be used for building and managing any java based project. 
  • Maven makes the build process easy and maintain a uniform project structure
  • Maven allows a project to build using its project object model ( POM ) and a set of plugins that are shared by all projects using Maven, providing a uniform build system.
  • POM is xml representation of a Maven project held in a file named pom.xml.
  • POM consists the necessary information about a project ( the basic groupId, artifactId, version dependencies, parent, modules, properties, dependencyManagement, packaging), build settings, reporting and environment settings. 
  • One of powerful addition that Maven brings to build management is the concept of project inheritance. You can see the detail description on this link. http://yoursanjeev.blogspot.com/2019/01/multi-module-project-in-java-using-maven.html  
  • Similar to the inheritance of objects in OOP ( object oriented programming ), POMs that extend a parent POM inherit certain values from the parent. 
  • You can take a look how the super POM affects your Project Object Model by creating a minimal pom.xml by,
    • Using mvn command, mvn help:effective-pom -Doutput=effective-pom.xml
    • Using intellj, Right click on pom.xml and
You can look the dependency tree with command, mvn dependency:tree

Reference :
 1.  https://maven.apache.org/what-is-maven.html 
 2. https://maven.apache.org/pom.html
 3. https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html

Comments