Maven: The Super POM ( pom.xml )

 

source: https://maven.apache.org/pom.html#The_Super_POM

 

The Super POM

Similar to the inheritance of objects in object oriented programming, POMs that extend a parent POM inherit certain values from that parent. Moreover, just as Java objects ultimately inherit from java.lang.Object, all Project Object Models inherit from a base Super POM. The snippet below is the Super POM for Maven 3.5.4.


 
  1. <project>
  2. <modelVersion>4.0.0</modelVersion>
  3.  
  4. <repositories>
  5. <repository>
  6. <id>central</id>
  7. <name>Central Repository</name>
  8. <url>https://repo.maven.apache.org/maven2</url>
  9. <layout>default</layout>
  10. <snapshots>
  11. <enabled>false</enabled>
  12. </snapshots>
  13. </repository>
  14. </repositories>
  15.  
  16. <pluginRepositories>
  17. <pluginRepository>
  18. <id>central</id>
  19. <name>Central Repository</name>
  20. <url>https://repo.maven.apache.org/maven2</url>
  21. <layout>default</layout>
  22. <snapshots>
  23. <enabled>false</enabled>
  24. </snapshots>
  25. <releases>
  26. <updatePolicy>never</updatePolicy>
  27. </releases>
  28. </pluginRepository>
  29. </pluginRepositories>
  30.  
  31. <build>
  32. <directory>${project.basedir}/target</directory>
  33. <outputDirectory>${project.build.directory}/classes</outputDirectory>
  34. <finalName>${project.artifactId}-${project.version}</finalName>
  35. <testOutputDirectory>${project.build.directory}/test-classes</testOutputDirectory>
  36. <sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
  37. <scriptSourceDirectory>${project.basedir}/src/main/scripts</scriptSourceDirectory>
  38. <testSourceDirectory>${project.basedir}/src/test/java</testSourceDirectory>
  39. <resources>
  40. <resource>
  41. <directory>${project.basedir}/src/main/resources</directory>
  42. </resource>
  43. </resources>
  44. <testResources>
  45. <testResource>
  46. <directory>${project.basedir}/src/test/resources</directory>
  47. </testResource>
  48. </testResources>
  49. <pluginManagement>
  50. <!-- NOTE: These plugins will be removed from future versions of the super POM -->
  51. <!-- They are kept for the moment as they are very unlikely to conflict with lifecycle mappings (MNG-4453) -->
  52. <plugins>
  53. <plugin>
  54. <artifactId>maven-antrun-plugin</artifactId>
  55. <version>1.3</version>
  56. </plugin>
  57. <plugin>
  58. <artifactId>maven-assembly-plugin</artifactId>
  59. <version>2.2-beta-5</version>
  60. </plugin>
  61. <plugin>
  62. <artifactId>maven-dependency-plugin</artifactId>
  63. <version>2.8</version>
  64. </plugin>
  65. <plugin>
  66. <artifactId>maven-release-plugin</artifactId>
  67. <version>2.5.3</version>
  68. </plugin>
  69. </plugins>
  70. </pluginManagement>
  71. </build>
  72.  
  73. <reporting>
  74. <outputDirectory>${project.build.directory}/site</outputDirectory>
  75. </reporting>
  76.  
  77. <profiles>
  78. <!-- NOTE: The release profile will be removed from future versions of the super POM -->
  79. <profile>
  80. <id>release-profile</id>
  81.  
  82. <activation>
  83. <property>
  84. <name>performRelease</name>
  85. <value>true</value>
  86. </property>
  87. </activation>
  88.  
  89. <build>
  90. <plugins>
  91. <plugin>
  92. <inherited>true</inherited>
  93. <artifactId>maven-source-plugin</artifactId>
  94. <executions>
  95. <execution>
  96. <id>attach-sources</id>
  97. <goals>
  98. <goal>jar-no-fork</goal>
  99. </goals>
  100. </execution>
  101. </executions>
  102. </plugin>
  103. <plugin>
  104. <inherited>true</inherited>
  105. <artifactId>maven-javadoc-plugin</artifactId>
  106. <executions>
  107. <execution>
  108. <id>attach-javadocs</id>
  109. <goals>
  110. <goal>jar</goal>
  111. </goals>
  112. </execution>
  113. </executions>
  114. </plugin>
  115. <plugin>
  116. <inherited>true</inherited>
  117. <artifactId>maven-deploy-plugin</artifactId>
  118. <configuration>
  119. <updateReleaseInfo>true</updateReleaseInfo>
  120. </configuration>
  121. </plugin>
  122. </plugins>
  123. </build>
  124. </profile>
  125. </profiles>
  126.  
  127. </project>

You can take a look at how the Super POM affects your Project Object Model by creating a minimal pom.xml and executing on the command line: mvn help:effective-pom

Tags