{"id":238,"date":"2010-04-14T11:04:22","date_gmt":"2010-04-14T11:04:22","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/2010\/04\/14\/what-is-pom\/"},"modified":"2017-12-27T08:11:15","modified_gmt":"2017-12-27T08:11:15","slug":"what-is-pom","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/what-is-pom\/","title":{"rendered":"Project Object Model &#8211; What is POM?"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4279\" src=\"http:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2010\/04\/pom.png\" alt=\"pom\" width=\"600\" height=\"400\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2010\/04\/pom.png 600w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2010\/04\/pom-300x200.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p><b>What is POM<\/b><br \/>\nA Project Object Model or POM is the fundamental unit of work in Maven. It is an XML file that contains information about the project and configuration details used by Maven to build the project. It contains default values for most projects. Examples for this are the build directory, which is target; the source directory, which is src\/main\/java; the test source directory, which is src\/main\/test; and so on.<br \/>\nThe POM was renamed from project.xml in Maven 1 to pom.xml in Maven 2. When executing a task or goal, Maven looks for the POM in the current directory. It reads the POM, gets the needed configuration information, then executes the goal.<br \/>\nSome of the configuration that can be specified in the POM are the project dependencies, the plugins or goals that can be executed, the build profiles, and so on. Other information such as the project version, description, developers, mailing lists and such can also be specified.<\/p>\n<p><b>Super POM<\/b><br \/>\nThe Super POM is Maven&#8217;s default POM. All POMs extend the Super POM unless explicitly set, meaning the configuration specified in the Super POM is inherited by the POMs you created for your projects. The snippet below is the Super POM for Maven 2.0.x.<br \/>\nThe snippet below is the Super POM for Maven 2.0.x.<br \/>\n4.0.0<br \/>\nMaven Default Project<\/p>\n<p>central<br \/>\nMaven Repository Switchboard<br \/>\ndefault<br \/>\nhttp:\/\/repo1.maven.org\/maven2<\/p>\n<p>false<\/p>\n<p>central<br \/>\nMaven Plugin Repository<br \/>\nhttp:\/\/repo1.maven.org\/maven2<br \/>\ndefault<\/p>\n<p>false<\/p>\n<p>never<\/p>\n<p>target<br \/>\ntarget\/classes<br \/>\n${artifactId}-${version}<br \/>\ntarget\/test-classes<br \/>\nsrc\/main\/java<br \/>\nsrc\/main\/scripts<br \/>\nsrc\/test\/java<\/p>\n<p>src\/main\/resources<\/p>\n<p>src\/test\/resources<\/p>\n<p>target\/site<br \/>\nrelease-profile<\/p>\n<p>performRelease<\/p>\n<p>true<br \/>\norg.apache.maven.plugins<br \/>\nmaven-source-plugin<\/p>\n<p>attach-sources<\/p>\n<p>jar<\/p>\n<p>true<br \/>\norg.apache.maven.plugins<br \/>\nmaven-javadoc-plugin<\/p>\n<p>attach-javadocs<\/p>\n<p>jar<\/p>\n<p>true<br \/>\norg.apache.maven.plugins<br \/>\nmaven-deploy-plugin<\/p>\n<p>true<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><a id=\"Minimal_POM\" class=\"mceItemAnchor\" name=\"Minimal_POM\"><\/a><b>Minimal POM<\/b><b> <\/b><br \/>\nThe minimum requirement for a POM are the following:<\/p>\n<ul type=\"disc\">\n<li>project root<\/li>\n<li>modelVersion &#8211; should be set to 4.0.0<\/li>\n<li>groupId &#8211; the id of the project&#8217;s group.<\/li>\n<li>artifactId &#8211; the id of the artifact (project)<\/li>\n<li>version &#8211; the version of the artifact under the specified group<\/li>\n<\/ul>\n<p>Here&#8217;s an example:<\/p>\n<pre><\/pre>\n<pre>\u00a0 4.0.0<\/pre>\n<pre> \u00a0com.mycompany.app<\/pre>\n<pre>\u00a0 my-app<\/pre>\n<pre>\u00a0 1<\/pre>\n<pre><\/pre>\n<p>A POM requires that its groupId, artifactId, and version be configured. These three values form the project&#8217;s fully qualified artifact name. This is in the form of ::. As for the example above, its fully qualified artifact name is &#8220;com.mycompany.app:my-app:1&#8221;.<br \/>\nEvery Maven project has a packaging type. If it is not specified in the POM, then the default value &#8220;jar&#8221; would be used.<br \/>\n<b>Project inheritance<\/b><br \/>\nElements in the POM that are merged are the following:<\/p>\n<ul type=\"disc\">\n<li>dependencies<\/li>\n<li>developers and contributors<\/li>\n<li>plugin lists (including reports)<\/li>\n<li>plugin executions with matching ids<\/li>\n<li>plugin configuration<\/li>\n<li>resources<\/li>\n<\/ul>\n<p>The Super POM is one example of project inheritance, however you can also introduce your own parent POMs by specifying the parent element in the POM, as demonstrated in the following examples.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is POM A Project Object Model or POM is the fundamental unit of work in Maven. It is an XML file that contains information about the project and configuration details used by Maven to build the project. It contains default values for most projects. Examples for this are the build directory, which is target;&#8230;<\/p>\n","protected":false},"author":1,"featured_media":4279,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","_joinchat":[],"footnotes":""},"categories":[2],"tags":[3895,3897,3877,3900,3901,3893,3894,2339,3899,3898,719,3896,3892],"class_list":["post-238","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorised","tag-about-pom","tag-minimal-pom","tag-pom","tag-pom-guide","tag-pom-in-maven","tag-pom-introduction","tag-pom-overview","tag-project","tag-project-inheritance","tag-project-object-model","tag-start","tag-super-pom","tag-what-is-pom"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/238","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=238"}],"version-history":[{"count":2,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/238\/revisions"}],"predecessor-version":[{"id":4280,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/238\/revisions\/4280"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media\/4279"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=238"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=238"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=238"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}