What is Maven POM file?
Overview
POM stands for Project Object Model. Maven POM file is an XML file. You can locate the file under the project root or base directory of the Maven project. It contains crucial information about the project and project configuration that are used by Maven to build the project.
Structure
Every POM file has the following:
project
modelVersion
groupID
artifactID
Version
Sample pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.testingdocs.demo.webapp</groupId> <artifactId>simple-webapp</artifactId> <packaging>war</packaging> <version>1.0-SNAPSHOT</version> <name>simple-webapp Maven Webapp</name> <url>http://www.testingdocs.com</url> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> <scope>test</scope> </dependency> </dependencies> <build> <finalName>simple-webapp</finalName> </build> </project>
Super POM
Super POM is the default parent POM. All the maven project pom files extend from Super POM. Maven uses the configuration from the Super POM to execute the goals. In case you want to override the parent configuration, you can do so in your project pom.xml. To check the default parent POM configuration with the use of effective POM.
Below are the steps to open Effective POM in different IDE’s
Eclipse IDE:
Open pom.xml in Maven Editor, click on Effective POM tab as shown below:
IntelliJ IDEA
Right click pom.xml >> Maven >> Show Effective POM
Command line
Browse to the project root directory in command console. Execute the below maven command as shown below:
/> mvn help:effective-pom