{"id":1193,"date":"2020-12-24T08:20:40","date_gmt":"2020-12-24T08:20:40","guid":{"rendered":"https:\/\/blog.samarthya.me\/wps\/?p=1193"},"modified":"2020-12-24T09:01:01","modified_gmt":"2020-12-24T09:01:01","slug":"maven-lifecycles","status":"publish","type":"post","link":"https:\/\/blog.samarthya.me\/wps\/2020\/12\/24\/maven-lifecycles\/","title":{"rendered":"Maven: Lifecycles"},"content":{"rendered":"\n<p class=\"has-drop-cap\">If you have worked with big projects you must have encountered <code>pom.xml<\/code> the central configuration for your projects that helps you build, test, and define your CI pipeline. There are other options that are available too, but that is for some other day.<\/p>\n\n\n\n<figure class=\"wp-block-pullquote is-style-solid-color\"><blockquote><p>POM = Project Object Model<\/p><\/blockquote><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Version: <code>mvn --version<\/code><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>mvn --version\nApache Maven 3.6.2 (40f52333136460af0dc0d7232c0dc0bcf0d9e117; 2019-08-27T20:36:16+05:30)\nMaven home: \/usr\/local\/Cellar\/maven\/3.6.2\/libexec\nJava version: 12.0.2, vendor: Oracle Corporation, runtime: \/Library\/Java\/JavaVirtualMachines\/jdk-12.0.2.jdk\/Contents\/Home\nDefault locale: en_IN, platform encoding: UTF-8\nOS name: \"mac os x\", version: \"10.15.7\", arch: \"x86_64\", family: \"mac\"<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Build lifecycle<\/h2>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>Maven is based around the central concept of a build lifecycle.&nbsp;<\/p><\/blockquote>\n\n\n\n<p><a href=\"https:\/\/maven.apache.org\/guides\/introduction\/introduction-to-the-lifecycle.html#Lifecycle_Reference\">Lifecycle<\/a> is process for building and distributing artifacts, it can be loosely termed as sequence of steps required to perform some actions. <\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>There are three built-in build lifecycles<\/p><p>1. default <\/p><p>2. clean and <\/p><p>3. site.<\/p><\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\">Clean Lifecycle<\/h2>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"251\" src=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2020\/12\/Screenshot-2020-12-23-at-10.37.52-PM-1024x251.png\" alt=\"\" class=\"wp-image-1195\" srcset=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2020\/12\/Screenshot-2020-12-23-at-10.37.52-PM-1024x251.png 1024w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2020\/12\/Screenshot-2020-12-23-at-10.37.52-PM-300x73.png 300w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2020\/12\/Screenshot-2020-12-23-at-10.37.52-PM-768x188.png 768w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2020\/12\/Screenshot-2020-12-23-at-10.37.52-PM-1536x376.png 1536w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2020\/12\/Screenshot-2020-12-23-at-10.37.52-PM.png 1700w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption><a href=\"https:\/\/maven.apache.org\/ref\/3.6.3\/maven-core\/lifecycles.html#clean_Lifecycle\">Clean lifecycle<\/a><\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Default Lifecycle<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table><tbody><tr><th>Phase<\/th><th>Description<\/th><\/tr><tr><td><code>validate<\/code><\/td><td>validate the project is correct and all necessary information is available.<\/td><\/tr><tr><td><code>initialize<\/code><\/td><td>initialize build state, e.g. set properties or create directories.<\/td><\/tr><tr><td><code>generate-sources<\/code><\/td><td>generate any source code for inclusion in compilation.<\/td><\/tr><tr><td><code>process-sources<\/code><\/td><td>process the source code, for example to filter any values.<\/td><\/tr><tr><td><code>generate-resources<\/code><\/td><td>generate resources for inclusion in the package.<\/td><\/tr><tr><td><code>process-resources<\/code><\/td><td>copy and process the resources into the destination directory, ready for packaging.<\/td><\/tr><tr><td><code>compile<\/code><\/td><td>compile the source code of the project.<\/td><\/tr><tr><td><code>process-classes<\/code><\/td><td>post-process the generated files from compilation, for example to do bytecode enhancement on Java classes.<\/td><\/tr><tr><td><code>generate-test-sources<\/code><\/td><td>generate any test source code for inclusion in compilation.<\/td><\/tr><tr><td><code>process-test-sources<\/code><\/td><td>process the test source code, for example to filter any values.<\/td><\/tr><tr><td><code>generate-test-resources<\/code><\/td><td>create resources for testing.<\/td><\/tr><tr><td><code>process-test-resources<\/code><\/td><td>copy and process the resources into the test destination directory.<\/td><\/tr><tr><td><code>test-compile<\/code><\/td><td>compile the test source code into the test destination directory<\/td><\/tr><tr><td><code>process-test-classes<\/code><\/td><td>post-process the generated files from test compilation, for example to do bytecode enhancement on Java classes.<\/td><\/tr><tr><td><code>test<\/code><\/td><td>run tests using a suitable unit testing framework. These tests should not require the code be packaged or deployed.<\/td><\/tr><tr><td><code>prepare-package<\/code><\/td><td>perform any operations necessary to prepare a package before the actual packaging. This often results in an unpacked, processed version of the package.<\/td><\/tr><tr><td><code>package<\/code><\/td><td>take the compiled code and package it in its distributable format, such as a JAR.<\/td><\/tr><tr><td><code>pre-integration-test<\/code><\/td><td>perform actions required before integration tests are executed. This may involve things such as setting up the required environment.<\/td><\/tr><tr><td><code>integration-test<\/code><\/td><td>process and deploy the package if necessary into an environment where integration tests can be run.<\/td><\/tr><tr><td><code>post-integration-test<\/code><\/td><td>perform actions required after integration tests have been executed. This may including cleaning up the environment.<\/td><\/tr><tr><td><code>verify<\/code><\/td><td>run any checks to verify the package is valid and meets quality criteria.<\/td><\/tr><tr><td><code>install<\/code><\/td><td>install the package into the local repository, for use as a dependency in other projects locally.<\/td><\/tr><tr><td><code>deploy<\/code><\/td><td>done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects.<\/td><\/tr><\/tbody><\/table><figcaption>default lifecycle<\/figcaption><\/figure>\n\n\n\n<p>A build life cycle is made up of phases, where each phase has a plugin goal attached to it. Each phase represents a stage in the lifecycle and execute in order. E.g. for clean lifecycle (as shown in image above) it will execute first <code>pre-clean<\/code> then <code>clean<\/code> &amp; lastly <code>post-clean<\/code>. <\/p>\n\n\n\n<p>Let&#8217;s look at the <code><a href=\"https:\/\/maven.apache.org\/plugins\/maven-clean-plugin\/\">maven-clean-plugin<\/a><\/code> for some details<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mvn help:describe -Dplugin=org.apache.maven.plugins:maven-clean-plugin<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;INFO] --- maven-help-plugin:3.2.0:describe (default-cli) @ restmon-parent ---\n&#91;INFO] org.apache.maven.plugins:maven-clean-plugin:3.0.0\n\nName: Apache Maven Clean Plugin\nDescription: The Maven Clean Plugin is a plugin that removes files generated\n  at build-time in a project's directory.\nGroup Id: org.apache.maven.plugins\nArtifact Id: maven-clean-plugin\nVersion: 3.0.0\nGoal Prefix: clean\n\nThis plugin has 2 goals:\n\nclean:clean\n  Description: Goal which cleans the build.\n    This attempts to clean a project's working directory of the files that were\n    generated at build-time. By default, it discovers and deletes the\n    directories configured in project.build.directory,\n    project.build.outputDirectory, project.build.testOutputDirectory, and\n    project.reporting.outputDirectory.\n    \n    Files outside the default may also be included in the deletion by\n    configuring the filesets tag.\n\nclean:help\n  Description: Display help information on maven-clean-plugin.\n    Call mvn clean:help -Ddetail=true -Dgoal=&lt;goal-name&gt; to display parameter\n    details.\n\nFor more information, run 'mvn help:describe &#91;...] -Ddetail'<\/code><\/pre>\n\n\n\n<p>if you use the <code>-Ddetail<\/code> some more information with respect to the two goals will be shown.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;INFO] \n&#91;INFO] --- maven-help-plugin:3.2.0:describe (default-cli) @ restmon-parent ---\n&#91;INFO] org.apache.maven.plugins:maven-clean-plugin:3.0.0\n\nName: Apache Maven Clean Plugin\nDescription: The Maven Clean Plugin is a plugin that removes files generated\n  at build-time in a project's directory.\nGroup Id: org.apache.maven.plugins\nArtifact Id: maven-clean-plugin\nVersion: 3.0.0\nGoal Prefix: clean\n\nThis plugin has 2 goals:\n\nclean:clean\n  Description: Goal which cleans the build.\n    This attempts to clean a project's working directory of the files that were\n    generated at build-time. By default, it discovers and deletes the\n    directories configured in project.build.directory,\n    project.build.outputDirectory, project.build.testOutputDirectory, and\n    project.reporting.outputDirectory.\n    \n    Files outside the default may also be included in the deletion by\n    configuring the filesets tag.\n  Implementation: org.apache.maven.plugins.clean.CleanMojo\n  Language: java\n\n  Available parameters:\n\n    excludeDefaultDirectories (Default: false)\n      User property: maven.clean.excludeDefaultDirectories\n      Disables the deletion of the default output directories configured for a\n      project. If set to true, only the files\/directories selected via the\n      parameter filesets will be deleted.\n      Starting with 3.0.0 the property has been renamed from\n      clean.excludeDefaultDirectories to maven.clean.excludeDefaultDirectories.\n\n    failOnError (Default: true)\n      User property: maven.clean.failOnError\n      Indicates whether the build will continue even if there are clean errors.\n\n    filesets\n      The list of file sets to delete, in addition to the default directories.\n      For example:\n      &lt;filesets&gt;\n       &lt;fileset&gt;\n       &lt;directory&gt;src\/main\/generated&lt;\/directory&gt;\n       &lt;followSymlinks&gt;false&lt;\/followSymlinks&gt;\n       &lt;useDefaultExcludes&gt;true&lt;\/useDefaultExcludes&gt;\n       &lt;includes&gt;\n       &lt;include&gt;*.java&lt;\/include&gt;\n       &lt;\/includes&gt;\n       &lt;excludes&gt;\n       &lt;exclude&gt;Template*&lt;\/exclude&gt;\n       &lt;\/excludes&gt;\n       &lt;\/fileset&gt;\n      &lt;\/filesets&gt;\n\n    followSymLinks (Default: false)\n      User property: maven.clean.followSymLinks\n      Sets whether the plugin should follow symbolic links while deleting files\n      from the default output directories of the project. Not following\n      symlinks requires more IO operations and heap memory, regardless whether\n      symlinks are actually present. So projects with a huge output directory\n      that knowingly does not contain symlinks can improve performance by\n      setting this parameter to true.\n      Starting with 3.0.0 the property has been renamed from\n      clean.followSymLinks to maven.clean.followSymLinks.\n\n    retryOnError (Default: true)\n      User property: maven.clean.retryOnError\n      Indicates whether the plugin should undertake additional attempts (after\n      a short delay) to delete a file if the first attempt failed. This is\n      meant to help deleting files that are temporarily locked by third-party\n      tools like virus scanners or search indexing.\n\n    skip (Default: false)\n      User property: maven.clean.skip\n      Disables the plugin execution.\n      Starting with 3.0.0 the property has been renamed from clean.skip to\n      maven.clean.skip.\n\n    verbose\n      User property: maven.clean.verbose\n      Sets whether the plugin runs in verbose mode. As of plugin version 2.3,\n      the default value is derived from Maven's global debug flag (compare\n      command line switch -X).\n      Starting with 3.0.0 the property has been renamed from clean.verbose to\n      maven.clean.verbose.\n\nclean:help\n  Description: Display help information on maven-clean-plugin.\n    Call mvn clean:help -Ddetail=true -Dgoal=&lt;goal-name&gt; to display parameter\n    details.\n  Implementation: org.apache.maven.plugins.clean.HelpMojo\n  Language: java\n\n  Available parameters:\n\n    detail (Default: false)\n      User property: detail\n      If true, display all settable properties for each goal.\n\n    goal\n      User property: goal\n      The name of the goal for which to show help. If unspecified, all goals\n      will be displayed.\n\n    indentSize (Default: 2)\n      User property: indentSize\n      The number of spaces per indentation level, should be positive.\n\n    lineLength (Default: 80)\n      User property: lineLength\n      The maximum length of a display line, should be positive.<\/code><\/pre>\n\n\n\n<p>The plugin goal is executed when the phase executes as part of the life cycle.<\/p>\n\n\n\n<figure class=\"wp-block-pullquote is-style-solid-color\"><blockquote><p>You can read more from the official documentation available <a href=\"https:\/\/maven.apache.org\/guides\/introduction\/introduction-to-the-lifecycle.html\">here<\/a>.<\/p><\/blockquote><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Effective POM<\/h2>\n\n\n\n<p>My dummy POM is as under<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;project&gt;\n &lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;\n &lt;groupId&gt;me.samarthya&lt;\/groupId&gt;\n &lt;artifactId&gt;art-one&lt;\/artifactId&gt;\n &lt;version&gt;1&lt;\/version&gt;\n&lt;\/project&gt;<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>mvn help:effective-pom -Dverbose<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;INFO] Scanning for projects...\n&#91;INFO]                                                                         \n&#91;INFO] ------------------------------------------------------------------------\n&#91;INFO] Building art-one 1\n&#91;INFO] ------------------------------------------------------------------------\n&#91;INFO] \n&#91;INFO] --- maven-help-plugin:3.2.0:effective-pom (default-cli) @ art-one ---\n&#91;INFO] \nEffective POMs, after inheritance, interpolation, and profiles are applied:\n\n&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\n&lt;!-- ====================================================================== --&gt;\n&lt;!--                                                                        --&gt;\n&lt;!-- Generated by Maven Help Plugin on 2020-12-24T08:18:00Z                 --&gt;\n&lt;!-- See: http:\/\/maven.apache.org\/plugins\/maven-help-plugin\/                --&gt;\n&lt;!--                                                                        --&gt;\n&lt;!-- ====================================================================== --&gt;\n&lt;!-- ====================================================================== --&gt;\n&lt;!--                                                                        --&gt;\n&lt;!-- Effective POM for project 'me.samarthya:art-one:jar:1'                 --&gt;\n&lt;!--                                                                        --&gt;\n&lt;!-- ====================================================================== --&gt;\n&lt;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\/xsd\/maven-4.0.0.xsd\"&gt;\n  &lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;  &lt;!-- me.samarthya:art-one:1, line 2 --&gt;\n  &lt;groupId&gt;me.samarthya&lt;\/groupId&gt;  &lt;!-- me.samarthya:art-one:1, line 3 --&gt;\n  &lt;artifactId&gt;art-one&lt;\/artifactId&gt;  &lt;!-- me.samarthya:art-one:1, line 4 --&gt;\n  &lt;version&gt;1&lt;\/version&gt;  &lt;!-- me.samarthya:art-one:1, line 5 --&gt;\n  &lt;repositories&gt;\n    &lt;repository&gt;\n      &lt;snapshots&gt;\n        &lt;enabled&gt;false&lt;\/enabled&gt;\n      &lt;\/snapshots&gt;\n      &lt;id&gt;central&lt;\/id&gt;\n      &lt;name&gt;Central Repository&lt;\/name&gt;\n      &lt;url&gt;https:\/\/repo.maven.apache.org\/maven2&lt;\/url&gt;\n    &lt;\/repository&gt;\n  &lt;\/repositories&gt;\n  &lt;pluginRepositories&gt;\n    &lt;pluginRepository&gt;\n      &lt;releases&gt;\n        &lt;updatePolicy&gt;never&lt;\/updatePolicy&gt;\n      &lt;\/releases&gt;\n      &lt;snapshots&gt;\n        &lt;enabled&gt;false&lt;\/enabled&gt;\n      &lt;\/snapshots&gt;\n      &lt;id&gt;central&lt;\/id&gt;\n      &lt;name&gt;Central Repository&lt;\/name&gt;\n      &lt;url&gt;https:\/\/repo.maven.apache.org\/maven2&lt;\/url&gt;\n    &lt;\/pluginRepository&gt;\n  &lt;\/pluginRepositories&gt;\n  &lt;build&gt;\n    &lt;sourceDirectory&gt;\/root\/Downloads\/pom\/src\/main\/java&lt;\/sourceDirectory&gt;\n    &lt;scriptSourceDirectory&gt;\/root\/Downloads\/pom\/src\/main\/scripts&lt;\/scriptSourceDirectory&gt;\n    &lt;testSourceDirectory&gt;\/root\/Downloads\/pom\/src\/test\/java&lt;\/testSourceDirectory&gt;\n    &lt;outputDirectory&gt;\/root\/Downloads\/pom\/target\/classes&lt;\/outputDirectory&gt;\n    &lt;testOutputDirectory&gt;\/root\/Downloads\/pom\/target\/test-classes&lt;\/testOutputDirectory&gt;\n    &lt;resources&gt;\n      &lt;resource&gt;\n        &lt;directory&gt;\/root\/Downloads\/pom\/src\/main\/resources&lt;\/directory&gt;\n      &lt;\/resource&gt;\n    &lt;\/resources&gt;\n    &lt;testResources&gt;\n      &lt;testResource&gt;\n        &lt;directory&gt;\/root\/Downloads\/pom\/src\/test\/resources&lt;\/directory&gt;\n      &lt;\/testResource&gt;\n    &lt;\/testResources&gt;\n    &lt;directory&gt;\/root\/Downloads\/pom\/target&lt;\/directory&gt;\n    &lt;finalName&gt;art-one-1&lt;\/finalName&gt;\n    &lt;pluginManagement&gt;\n      &lt;plugins&gt;\n        &lt;plugin&gt;\n          &lt;artifactId&gt;maven-antrun-plugin&lt;\/artifactId&gt;\n          &lt;version&gt;1.3&lt;\/version&gt;\n        &lt;\/plugin&gt;\n        &lt;plugin&gt;\n          &lt;artifactId&gt;maven-assembly-plugin&lt;\/artifactId&gt;\n          &lt;version&gt;2.2-beta-5&lt;\/version&gt;\n        &lt;\/plugin&gt;\n        &lt;plugin&gt;\n          &lt;artifactId&gt;maven-dependency-plugin&lt;\/artifactId&gt;\n          &lt;version&gt;2.1&lt;\/version&gt;\n        &lt;\/plugin&gt;\n        &lt;plugin&gt;\n          &lt;artifactId&gt;maven-release-plugin&lt;\/artifactId&gt;\n          &lt;version&gt;2.0&lt;\/version&gt;\n        &lt;\/plugin&gt;\n      &lt;\/plugins&gt;\n    &lt;\/pluginManagement&gt;\n    &lt;plugins&gt;\n      &lt;plugin&gt;\n        &lt;artifactId&gt;maven-clean-plugin&lt;\/artifactId&gt;\n        &lt;version&gt;2.4.1&lt;\/version&gt;\n        &lt;executions&gt;\n          &lt;execution&gt;\n            &lt;id&gt;default-clean&lt;\/id&gt;\n            &lt;phase&gt;clean&lt;\/phase&gt;\n            &lt;goals&gt;\n              &lt;goal&gt;clean&lt;\/goal&gt;\n            &lt;\/goals&gt;\n          &lt;\/execution&gt;\n        &lt;\/executions&gt;\n      &lt;\/plugin&gt;\n      &lt;plugin&gt;\n        &lt;artifactId&gt;maven-resources-plugin&lt;\/artifactId&gt;\n        &lt;version&gt;2.5&lt;\/version&gt;\n        &lt;executions&gt;\n          &lt;execution&gt;\n            &lt;id&gt;default-testResources&lt;\/id&gt;\n            &lt;phase&gt;process-test-resources&lt;\/phase&gt;\n            &lt;goals&gt;\n              &lt;goal&gt;testResources&lt;\/goal&gt;\n            &lt;\/goals&gt;\n          &lt;\/execution&gt;\n          &lt;execution&gt;\n            &lt;id&gt;default-resources&lt;\/id&gt;\n            &lt;phase&gt;process-resources&lt;\/phase&gt;\n            &lt;goals&gt;\n              &lt;goal&gt;resources&lt;\/goal&gt;\n            &lt;\/goals&gt;\n          &lt;\/execution&gt;\n        &lt;\/executions&gt;\n      &lt;\/plugin&gt;\n      &lt;plugin&gt;\n        &lt;artifactId&gt;maven-jar-plugin&lt;\/artifactId&gt;\n        &lt;version&gt;2.3.2&lt;\/version&gt;\n        &lt;executions&gt;\n          &lt;execution&gt;\n            &lt;id&gt;default-jar&lt;\/id&gt;\n            &lt;phase&gt;package&lt;\/phase&gt;\n            &lt;goals&gt;\n              &lt;goal&gt;jar&lt;\/goal&gt;\n            &lt;\/goals&gt;\n          &lt;\/execution&gt;\n        &lt;\/executions&gt;\n      &lt;\/plugin&gt;\n      &lt;plugin&gt;\n        &lt;artifactId&gt;maven-compiler-plugin&lt;\/artifactId&gt;\n        &lt;version&gt;2.3.2&lt;\/version&gt;\n        &lt;executions&gt;\n          &lt;execution&gt;\n            &lt;id&gt;default-compile&lt;\/id&gt;\n            &lt;phase&gt;compile&lt;\/phase&gt;\n            &lt;goals&gt;\n              &lt;goal&gt;compile&lt;\/goal&gt;\n            &lt;\/goals&gt;\n          &lt;\/execution&gt;\n          &lt;execution&gt;\n            &lt;id&gt;default-testCompile&lt;\/id&gt;\n            &lt;phase&gt;test-compile&lt;\/phase&gt;\n            &lt;goals&gt;\n              &lt;goal&gt;testCompile&lt;\/goal&gt;\n            &lt;\/goals&gt;\n          &lt;\/execution&gt;\n        &lt;\/executions&gt;\n      &lt;\/plugin&gt;\n      &lt;plugin&gt;\n        &lt;artifactId&gt;maven-surefire-plugin&lt;\/artifactId&gt;\n        &lt;version&gt;2.10&lt;\/version&gt;\n        &lt;executions&gt;\n          &lt;execution&gt;\n            &lt;id&gt;default-test&lt;\/id&gt;\n            &lt;phase&gt;test&lt;\/phase&gt;\n            &lt;goals&gt;\n              &lt;goal&gt;test&lt;\/goal&gt;\n            &lt;\/goals&gt;\n          &lt;\/execution&gt;\n        &lt;\/executions&gt;\n      &lt;\/plugin&gt;\n      &lt;plugin&gt;\n        &lt;artifactId&gt;maven-install-plugin&lt;\/artifactId&gt;\n        &lt;version&gt;2.3.1&lt;\/version&gt;\n        &lt;executions&gt;\n          &lt;execution&gt;\n            &lt;id&gt;default-install&lt;\/id&gt;\n            &lt;phase&gt;install&lt;\/phase&gt;\n            &lt;goals&gt;\n              &lt;goal&gt;install&lt;\/goal&gt;\n            &lt;\/goals&gt;\n          &lt;\/execution&gt;\n        &lt;\/executions&gt;\n      &lt;\/plugin&gt;\n      &lt;plugin&gt;\n        &lt;artifactId&gt;maven-deploy-plugin&lt;\/artifactId&gt;\n        &lt;version&gt;2.7&lt;\/version&gt;\n        &lt;executions&gt;\n          &lt;execution&gt;\n            &lt;id&gt;default-deploy&lt;\/id&gt;\n            &lt;phase&gt;deploy&lt;\/phase&gt;\n            &lt;goals&gt;\n              &lt;goal&gt;deploy&lt;\/goal&gt;\n            &lt;\/goals&gt;\n          &lt;\/execution&gt;\n        &lt;\/executions&gt;\n      &lt;\/plugin&gt;\n      &lt;plugin&gt;\n        &lt;artifactId&gt;maven-site-plugin&lt;\/artifactId&gt;\n        &lt;version&gt;3.0&lt;\/version&gt;\n        &lt;executions&gt;\n          &lt;execution&gt;\n            &lt;id&gt;default-site&lt;\/id&gt;\n            &lt;phase&gt;site&lt;\/phase&gt;\n            &lt;goals&gt;\n              &lt;goal&gt;site&lt;\/goal&gt;\n            &lt;\/goals&gt;\n            &lt;configuration&gt;\n              &lt;outputDirectory&gt;\/root\/Downloads\/pom\/target\/site&lt;\/outputDirectory&gt;\n              &lt;reportPlugins&gt;\n                &lt;reportPlugin&gt;\n                  &lt;groupId&gt;org.apache.maven.plugins&lt;\/groupId&gt;\n                  &lt;artifactId&gt;maven-project-info-reports-plugin&lt;\/artifactId&gt;\n                &lt;\/reportPlugin&gt;\n              &lt;\/reportPlugins&gt;\n            &lt;\/configuration&gt;\n          &lt;\/execution&gt;\n          &lt;execution&gt;\n            &lt;id&gt;default-deploy&lt;\/id&gt;\n            &lt;phase&gt;site-deploy&lt;\/phase&gt;\n            &lt;goals&gt;\n              &lt;goal&gt;deploy&lt;\/goal&gt;\n            &lt;\/goals&gt;\n            &lt;configuration&gt;\n              &lt;outputDirectory&gt;\/root\/Downloads\/pom\/target\/site&lt;\/outputDirectory&gt;\n              &lt;reportPlugins&gt;\n                &lt;reportPlugin&gt;\n                  &lt;groupId&gt;org.apache.maven.plugins&lt;\/groupId&gt;\n                  &lt;artifactId&gt;maven-project-info-reports-plugin&lt;\/artifactId&gt;\n                &lt;\/reportPlugin&gt;\n              &lt;\/reportPlugins&gt;\n            &lt;\/configuration&gt;\n          &lt;\/execution&gt;\n        &lt;\/executions&gt;\n        &lt;configuration&gt;\n          &lt;outputDirectory&gt;\/root\/Downloads\/pom\/target\/site&lt;\/outputDirectory&gt;\n          &lt;reportPlugins&gt;\n            &lt;reportPlugin&gt;\n              &lt;groupId&gt;org.apache.maven.plugins&lt;\/groupId&gt;\n              &lt;artifactId&gt;maven-project-info-reports-plugin&lt;\/artifactId&gt;\n            &lt;\/reportPlugin&gt;\n          &lt;\/reportPlugins&gt;\n        &lt;\/configuration&gt;\n      &lt;\/plugin&gt;\n    &lt;\/plugins&gt;\n  &lt;\/build&gt;\n  &lt;reporting&gt;\n    &lt;outputDirectory&gt;\/root\/Downloads\/pom\/target\/site&lt;\/outputDirectory&gt;\n  &lt;\/reporting&gt;\n&lt;\/project&gt;\n\n\n&#91;INFO] ------------------------------------------------------------------------\n&#91;INFO] BUILD SUCCESS\n&#91;INFO] ------------------------------------------------------------------------\n&#91;INFO] Total time: 0.723s\n&#91;INFO] Finished at: Thu Dec 24 08:18:00 UTC 2020\n&#91;INFO] Final Memory: 15M\/605M\n&#91;INFO] ------------------------------------------------------------------------<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Example: <code>inheritance<\/code><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Parent POM<\/h3>\n\n\n\n<p>Please note the <code>packaging<\/code> and the <code>name<\/code> defined<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;project>\n   &lt;modelVersion>4.0.0&lt;\/modelVersion>\n\n &lt;groupId>me.samarthya&lt;\/groupId>\n &lt;artifactId>art-one&lt;\/artifactId>\n &lt;version>1&lt;\/version>\n\n &lt;packaging>pom&lt;\/packaging>\n\n &lt;name>parent-pom&lt;\/name>\n&lt;\/project><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Child POM<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;project>\n\n  &lt;parent>\n    &lt;relativePath>..\/pom.xml&lt;\/relativePath>\n    &lt;groupId>me.samarthya&lt;\/groupId>\n    &lt;artifactId>art-one&lt;\/artifactId>\n    &lt;version>1&lt;\/version>\n  &lt;\/parent>\n\n &lt;modelVersion>4.0.0&lt;\/modelVersion>\n\n &lt;groupId>me.samarthya&lt;\/groupId>\n &lt;artifactId>art-two&lt;\/artifactId>\n &lt;version>1.0&lt;\/version>\n\n &lt;packaging>jar&lt;\/packaging>\n\n &lt;name>child-pom&lt;\/name>\n&lt;\/project><\/code><\/pre>\n\n\n\n<p>If you request for effective pom <code>help:effective-pom<\/code><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;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\/xsd\/maven-4.0.0.xsd\">\n  &lt;modelVersion>4.0.0&lt;\/modelVersion>\n  &lt;parent>\n    &lt;groupId>me.samarthya&lt;\/groupId>\n    &lt;artifactId>art-one&lt;\/artifactId>\n    &lt;version>1&lt;\/version>\n  &lt;\/parent>\n  &lt;groupId>me.samarthya&lt;\/groupId>\n  &lt;artifactId>art-two&lt;\/artifactId>\n  &lt;version>1.0&lt;\/version>\n  &lt;name>child-pom&lt;\/name>\n  &lt;repositories>\n    &lt;repository>\n      &lt;snapshots>\n        &lt;enabled>false&lt;\/enabled>\n      &lt;\/snapshots>\n      &lt;id>central&lt;\/id>\n      &lt;name>Central Repository&lt;\/name>\n      &lt;url>https:\/\/repo.maven.apache.org\/maven2&lt;\/url>\n    &lt;\/repository>\n  &lt;\/repositories>\n  &lt;pluginRepositories>\n    &lt;pluginRepository>\n      &lt;releases>\n        &lt;updatePolicy>never&lt;\/updatePolicy>\n      &lt;\/releases>\n      &lt;snapshots>\n        &lt;enabled>false&lt;\/enabled>\n      &lt;\/snapshots>\n      &lt;id>central&lt;\/id>\n      &lt;name>Central Repository&lt;\/name>\n      &lt;url>https:\/\/repo.maven.apache.org\/maven2&lt;\/url>\n    &lt;\/pluginRepository>\n  &lt;\/pluginRepositories>\n  &lt;build>\n    &lt;sourceDirectory>\/root\/Downloads\/pom\/child\/src\/main\/java&lt;\/sourceDirectory>\n    &lt;scriptSourceDirectory>\/root\/Downloads\/pom\/child\/src\/main\/scripts&lt;\/scriptSourceDirectory>\n    &lt;testSourceDirectory>\/root\/Downloads\/pom\/child\/src\/test\/java&lt;\/testSourceDirectory>\n    &lt;outputDirectory>\/root\/Downloads\/pom\/child\/target\/classes&lt;\/outputDirectory>\n    &lt;testOutputDirectory>\/root\/Downloads\/pom\/child\/target\/test-classes&lt;\/testOutputDirectory>\n    &lt;resources>\n      &lt;resource>\n        &lt;directory>\/root\/Downloads\/pom\/child\/src\/main\/resources&lt;\/directory>\n      &lt;\/resource>\n    &lt;\/resources>\n    &lt;testResources>\n      &lt;testResource>\n        &lt;directory>\/root\/Downloads\/pom\/child\/src\/test\/resources&lt;\/directory>\n      &lt;\/testResource>\n    &lt;\/testResources>\n    &lt;directory>\/root\/Downloads\/pom\/child\/target&lt;\/directory>\n    &lt;finalName>art-two-1.0&lt;\/finalName>\n    &lt;pluginManagement>\n      &lt;plugins>\n        &lt;plugin>\n          &lt;artifactId>maven-antrun-plugin&lt;\/artifactId>\n          &lt;version>1.3&lt;\/version>\n        &lt;\/plugin>\n        &lt;plugin>\n          &lt;artifactId>maven-assembly-plugin&lt;\/artifactId>\n          &lt;version>2.2-beta-5&lt;\/version>\n        &lt;\/plugin>\n        &lt;plugin>\n          &lt;artifactId>maven-dependency-plugin&lt;\/artifactId>\n          &lt;version>2.1&lt;\/version>\n        &lt;\/plugin>\n        &lt;plugin>\n          &lt;artifactId>maven-release-plugin&lt;\/artifactId>\n          &lt;version>2.0&lt;\/version>\n        &lt;\/plugin>\n      &lt;\/plugins>\n    &lt;\/pluginManagement>\n    &lt;plugins>\n      &lt;plugin>\n        &lt;artifactId>maven-clean-plugin&lt;\/artifactId>\n        &lt;version>2.4.1&lt;\/version>\n        &lt;executions>\n          &lt;execution>\n            &lt;id>default-clean&lt;\/id>\n            &lt;phase>clean&lt;\/phase>\n            &lt;goals>\n              &lt;goal>clean&lt;\/goal>\n            &lt;\/goals>\n          &lt;\/execution>\n        &lt;\/executions>\n      &lt;\/plugin>\n      &lt;plugin>\n        &lt;artifactId>maven-resources-plugin&lt;\/artifactId>\n        &lt;version>2.5&lt;\/version>\n        &lt;executions>\n          &lt;execution>\n            &lt;id>default-testResources&lt;\/id>\n            &lt;phase>process-test-resources&lt;\/phase>\n            &lt;goals>\n              &lt;goal>testResources&lt;\/goal>\n            &lt;\/goals>\n          &lt;\/execution>\n          &lt;execution>\n            &lt;id>default-resources&lt;\/id>\n            &lt;phase>process-resources&lt;\/phase>\n            &lt;goals>\n              &lt;goal>resources&lt;\/goal>\n            &lt;\/goals>\n          &lt;\/execution>\n        &lt;\/executions>\n      &lt;\/plugin>\n      &lt;plugin>\n        &lt;artifactId>maven-jar-plugin&lt;\/artifactId>\n        &lt;version>2.3.2&lt;\/version>\n        &lt;executions>\n          &lt;execution>\n            &lt;id>default-jar&lt;\/id>\n            &lt;phase>package&lt;\/phase>\n            &lt;goals>\n              &lt;goal>jar&lt;\/goal>\n            &lt;\/goals>\n          &lt;\/execution>\n        &lt;\/executions>\n      &lt;\/plugin>\n      &lt;plugin>\n        &lt;artifactId>maven-compiler-plugin&lt;\/artifactId>\n        &lt;version>2.3.2&lt;\/version>\n        &lt;executions>\n          &lt;execution>\n            &lt;id>default-compile&lt;\/id>\n            &lt;phase>compile&lt;\/phase>\n            &lt;goals>\n              &lt;goal>compile&lt;\/goal>\n            &lt;\/goals>\n          &lt;\/execution>\n          &lt;execution>\n            &lt;id>default-testCompile&lt;\/id>\n            &lt;phase>test-compile&lt;\/phase>\n            &lt;goals>\n              &lt;goal>testCompile&lt;\/goal>\n            &lt;\/goals>\n          &lt;\/execution>\n        &lt;\/executions>\n      &lt;\/plugin>\n      &lt;plugin>\n        &lt;artifactId>maven-surefire-plugin&lt;\/artifactId>\n        &lt;version>2.10&lt;\/version>\n        &lt;executions>\n          &lt;execution>\n            &lt;id>default-test&lt;\/id>\n            &lt;phase>test&lt;\/phase>\n            &lt;goals>\n              &lt;goal>test&lt;\/goal>\n            &lt;\/goals>\n          &lt;\/execution>\n        &lt;\/executions>\n      &lt;\/plugin>\n      &lt;plugin>\n        &lt;artifactId>maven-install-plugin&lt;\/artifactId>\n        &lt;version>2.3.1&lt;\/version>\n        &lt;executions>\n          &lt;execution>\n            &lt;id>default-install&lt;\/id>\n            &lt;phase>install&lt;\/phase>\n            &lt;goals>\n              &lt;goal>install&lt;\/goal>\n            &lt;\/goals>\n          &lt;\/execution>\n        &lt;\/executions>\n      &lt;\/plugin>\n      &lt;plugin>\n        &lt;artifactId>maven-deploy-plugin&lt;\/artifactId>\n        &lt;version>2.7&lt;\/version>\n        &lt;executions>\n          &lt;execution>\n            &lt;id>default-deploy&lt;\/id>\n            &lt;phase>deploy&lt;\/phase>\n            &lt;goals>\n              &lt;goal>deploy&lt;\/goal>\n            &lt;\/goals>\n          &lt;\/execution>\n        &lt;\/executions>\n      &lt;\/plugin>\n      &lt;plugin>\n        &lt;artifactId>maven-site-plugin&lt;\/artifactId>\n        &lt;version>3.0&lt;\/version>\n        &lt;executions>\n          &lt;execution>\n            &lt;id>default-site&lt;\/id>\n            &lt;phase>site&lt;\/phase>\n            &lt;goals>\n              &lt;goal>site&lt;\/goal>\n            &lt;\/goals>\n            &lt;configuration>\n              &lt;outputDirectory>\/root\/Downloads\/pom\/child\/target\/site&lt;\/outputDirectory>\n              &lt;reportPlugins>\n                &lt;reportPlugin>\n                  &lt;groupId>org.apache.maven.plugins&lt;\/groupId>\n                  &lt;artifactId>maven-project-info-reports-plugin&lt;\/artifactId>\n                &lt;\/reportPlugin>\n              &lt;\/reportPlugins>\n            &lt;\/configuration>\n          &lt;\/execution>\n          &lt;execution>\n            &lt;id>default-deploy&lt;\/id>\n            &lt;phase>site-deploy&lt;\/phase>\n            &lt;goals>\n              &lt;goal>deploy&lt;\/goal>\n            &lt;\/goals>\n            &lt;configuration>\n              &lt;outputDirectory>\/root\/Downloads\/pom\/child\/target\/site&lt;\/outputDirectory>\n              &lt;reportPlugins>\n                &lt;reportPlugin>\n                  &lt;groupId>org.apache.maven.plugins&lt;\/groupId>\n                  &lt;artifactId>maven-project-info-reports-plugin&lt;\/artifactId>\n                &lt;\/reportPlugin>\n              &lt;\/reportPlugins>\n            &lt;\/configuration>\n          &lt;\/execution>\n        &lt;\/executions>\n        &lt;configuration>\n          &lt;outputDirectory>\/root\/Downloads\/pom\/child\/target\/site&lt;\/outputDirectory>\n          &lt;reportPlugins>\n            &lt;reportPlugin>\n              &lt;groupId>org.apache.maven.plugins&lt;\/groupId>\n              &lt;artifactId>maven-project-info-reports-plugin&lt;\/artifactId>\n            &lt;\/reportPlugin>\n          &lt;\/reportPlugins>\n        &lt;\/configuration>\n      &lt;\/plugin>\n    &lt;\/plugins>\n  &lt;\/build>\n  &lt;reporting>\n    &lt;outputDirectory>\/root\/Downloads\/pom\/child\/target\/site&lt;\/outputDirectory>\n  &lt;\/reporting>\n&lt;\/project><\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Helpers<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>https:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd<\/li><li>http:\/\/maven.apache.org\/ref\/3.6.3\/maven-model-builder\/super-pom.html<\/li><\/ul>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you have worked with big projects you must have encountered pom.xml the central configuration for your projects that helps you build, test, and define your CI pipeline. There are other options that are available too, but that is for some other day. POM = Project Object Model Version: mvn &#8211;version Build lifecycle Maven is [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":1197,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"image","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[34],"tags":[134,133],"class_list":["post-1193","post","type-post","status-publish","format-image","has-post-thumbnail","hentry","category-technical","tag-lifecycle","tag-maven","post_format-post-format-image"],"_links":{"self":[{"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/posts\/1193","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/comments?post=1193"}],"version-history":[{"count":0,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/posts\/1193\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/media\/1197"}],"wp:attachment":[{"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/media?parent=1193"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/categories?post=1193"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/tags?post=1193"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}