Maven parent POM

Source: Internet
Author: User
Parent pom: globally defines the project model. The child pom inherits the configuration of the parent pom.
Main configuration: define basic project information, such as license <licenses> <license> <Name> the Apache software license, version 2.0 </Name> <URL> http://www.apache.org/licenses/LICENSE-2.0.txt </URL> <distribution> repo </distribution> </license> </licenses>
Define the company's unified repository location: for example, jardeploy location <! -- Publish location configuration --> <distributionmanagement> <repository> <ID> nexus-releases </ID> <Name> internal release repository </Name> <URL> http://nexus.xxx.com/content/repositories/releases/ </URL> </Repository> <snapshotrepository> <ID> nexus-snapshots </ID> <Name> internal snapshot repository </Name> <URL> http://nexus.xxx.com/content/repositories/snapshots/ </URL> </snapshotrepository> </distributionmanagement>

Define global plug-ins: for example, <plugins> <plugin> <inherited> true </inherited> <groupid> Org. apache. maven. plugins </groupid> <artifactid> Maven-compiler-plugin </artifactid> <configuration> <source> 1.6 </source> <target> 1.6 </Target> <optimize> true </optimize> <debug> true </debug> </configuration> </plugin> <groupid> Org. apache. maven. plugins </groupid> <artifactid> Maven-resources-plugin </artifactid> <configuration> <encoding> UTF-8 </encoding> </configuration> </plugin>
<! -- Release source code jar --> <plugin> <groupid> Org. apache. maven. plugins </groupid> <artifactid> Maven-source-plugin </artifactid> <version> 2.1.2 </version> <executions> <execution> <ID> attach-sources </ID> <phase> deploy </phase> </execution> </executions> </plugin>
<! -- Release javadoc --> <plugin> <groupid> Org. apache. maven. plugins </groupid> <artifactid> Maven-javadoc-plugin </artifactid> <version> 2.8.1 </version> <executions> <execution> <ID> attach-javadocs </ID> <goals> <goal> jar </goal> </goals> </execution> </executions> </plugin> </plugins> </build>
Unified management of jar versions: you do not need to add the version and scope attributes to the sub-project when introducing jar: for example, <! -- Manage the jar package version --> <dependencymanagement> <dependencies> <dependency> <groupid> com. peaceful </groupid> <artifactid> nuggets-peaceful-utils </artifactid> <version> 1.0-Snapshot </version> </dependency> </dependencies> </dependencymanagement>
Define the company's unified jar package dependency: in this way, all projects that configure parent can depend on the following JAR files in their own projects, such as <dependencies>
<! -- JUnit dependency for testing --> <dependency> <groupid> JUnit </groupid> <artifactid> JUnit </artifactid> <version >$ {JUnit. version }</version> <scope> test </scope> </dependency> </dependencies>

Summary parent Pom is mainly used to describe the project model globally.

Maven parent POM

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.