Maven Combat (iii)--pom.xml detailed

Source: Internet
Author: User
Tags unique id
1. Overview

The nodes in Pom are distributed as follows

<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" > <modelVersion>4.0.0</modelVersion> <!--basic configuration--> <groupId>...</groupId> <ar


    Tifactid>...</artifactid> <version>...</version> <packaging>...</packaging> <!--dependency configuration--> <dependencies>...</dependencies> <parent>...</parent> <depende Ncymanagement>...</dependencymanagement> <modules>...</modules> <properties>...</

    Properties> <!--build configuration--> <build>...</build> <reporting>...</reporting> <!--project information--> <name>...</name> <description>...</description> <url>...&lt ;/url> <inceptionYear>...</inceptionyear> <licenses>...</licenses> <organization>...</organization&
    Gt <developers>...</developers> <contributors>...</contributors> <!--environment settings--> ;issuemanagement>...</issuemanagement> <ciManagement>...</ciManagement> <mailinglists >...</mailingLists> <scm>...</scm> <prerequisites>...</prerequisites> <rep Ositories>...</repositories> <pluginRepositories>...</pluginRepositories> < Distributionmanagement>...</distributionmanagement> <profiles>...</profiles> </project >
2. Basic Configuration

Modelversion:pom model version, MAVEN2 and 3 can only be 4.0.0
GroupId: Group Id,maven for positioning
Artifactid: Unique ID in the group is used to locate
Version: Project Versions
Packaging: Project Packaging method with the following values: Pom, jar, Maven-plugin, EJB, War, Ear, RAR, par 3. Dependent configuration

Parent

Used to determine the coordinates of the parent project.

<parent>
    <groupId>com.learnPro</groupId>
    <artifactid>sip-parent</artifactid >
    <relativePath></relativePath>
    <version>0.0.1-SNAPSHOT</version>
</ Parent>

GroupId: Widget identifier for parent project
Artifactid: Unique identifier of the parent project
Relativepath:maven first the POM for the parent item in the current project, then in this location in the file system (RelativePath), then in the local warehouse, and then in the remote warehouse.
Version: versions of parent projects
Modules

Some MAVEN projects can be made into multiple modules, which are used to specify all the modules that the current project contains. The MAVEN operation on the project will then have all the child modules do the same.

<modules>
   <module>com-a</>
   <module>com-b</>
   <module>com-c</ >
</>
Properties

Used to define Pom constants

<properties>
    <java.version>1.7</java.version>
</properties>

The above constants can be referenced anywhere in the pom file by ${java.version}

Dependencies

Project dependent configuration, if the dependency written on the parent project is referenced by the quilt project, the general parent will introduce the dependencies common to the subproject (which will be explained in detail later)

<dependencies>
    <dependency>
            <groupId>junit</groupId>
            <artifactId> junit</artifactid>
            <version>4.12</version>
    </dependency>
</ Dependencies>

This side depends on the same as in the central warehouse, you can introduce the corresponding jar

Dependencymanagement

Configuration writing with dependencies

<dependencyManagement>
    <dependencies>
    ..... </dependencies>
</dependencyManagement>

When defined in the parent module, the child module does not directly use the corresponding dependencies, but it can be used without the version number when using the same dependencies:

Parent Project:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupid>junit</ groupid>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            < scope>test</scope>
        </dependency>
    </dependencies>
</dependencymanagement >

Sub item:

<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
</dependency>

The benefit is that the parent project unifies the version, and the subproject can refer to the dependency 4 when it is needed . Build configuration Builds

Used to configure information about project construction

<build> <!--This element sets the project source directory, and when you build the project, the build system compiles the source code in the directory. The path is a relative path relative to the pom.xml. --> <sourceDirectory/> <!--This element sets the project scripting source directory, which is different from the source directory: In most cases, the contents of the directory are copied to the output directory (because the script is interpreted, not edited Translated). --> <scriptSourceDirectory/> <!--This element sets the source directory used for the project unit test, and when the project is tested, the build system compiles the source code in the directory. The path is a relative path relative to the pom.xml. --> <testSourceDirectory/> <!--the directory where the compiled application class files are stored. --> <outputDirectory/> <!--the directory where the compiled test class files are stored. --> <testOutputDirectory/> <!--uses a series of build extensions from this project--> <extensions> <!--describes the Build the extension. --> <extension> <!--build Extended groupid--> <groupId/> <!--build Extended artifactid- -> <artifactId/> <!--build an extended version--> <version/> </extension> &L T;/extensions> <!--The default value when a project does not specify a goal (Maven2 is called a phase)--> <defaultGoal/> <!--This element describes all resource paths related to the project A path list, such as a project-related property file, that is included in the finalIn the package file. --> <resources> <!--This element describes the project-related or test-related resource paths--> <resource> <!--describes the resource's purpose The standard path. The path is relative to the target/classes directory (for example, ${project.build.outputdirectory}). For example, if you want the resource to be in a particular package (org.apache.maven.messages), you must set the element to Org/apache/maven/messages. However, if you just want to put resources into the source directory structure, you do not need this configuration. --> <targetPath/> <!--whether to use parameter values instead of parameter names. Parameter values are taken from properties that are configured in the property element or in the file, and are listed in the filters element. --> <filtering/> <!--describes the directory where the resource is stored, which is relative to the POM path--> <directory/> <!--containing the modulo list, such as **/*.xml.--> <includes/> <!--excluded schema list, such as **/*.xml--> <excludes/> & Lt;/resource> </resources> <!--This element describes all the resource paths associated with the unit test, such as the property files associated with the unit test. --> <testResources> <!--This element describes all the resource paths associated with the test, see the description of the Build/resources/resource element--> <testr Esource> <targetPath/><filtering/><directory/><includes/><excludes/> </ TestresourcE> </testResources> <!--build All files stored in the directory--> <directory/> <!--The file name of the artifacts generated, the default value is $ {artifactid}-${version}. --> <finalName/> <!--when the filtering switch is turned on, the filter properties file list that is used--> <filters/> <!--Sub Project can The default plug-in information that is referenced. The plug-in configuration item is not parsed or bound to the lifecycle until it is referenced. Any local configuration for a given plug-in will overwrite the list of plug-ins used in the configuration--> <pluginManagement> <!--here. The--> <plugins> <!--plugin element contains the information required to describe the plug-in. --> <plugin> <!--plugin in the warehouse of the group id--> <groupId/> <!--plugin in the warehouse artif Act id--> <artifactId/> <!--the version (or version range) of the plug-in being used--> <version/> <!- -whether to download Maven extensions from the plug-in (for example, packaging and type processors), because of performance reasons, the element is set to Enabled only when the download is really needed. --> <extensions/> <!--perform a set of target configurations during the build lifecycle. Each target may have a different configuration. --> <executions> <!--execution element contains the information required for plug-in execution--> <execution> & lt;! --The identifier of the execution target, used to identify the target in the build process, or to match the inheritance processThe execution targets to be merged--> <id/> <!--bind the build lifecycle phase of the target, and if omitted, the target is bound to the default phase of the configuration in the source data--> <phase/ > <!--configuration--> <goals/> <!--configuration is propagated to the sub pom--> <inherit Ed/> <!--configuration as a DOM object--> <configuration/> </execution> </ex Ecutions> <!--Project The additional dependencies required to introduce Plug-ins--> <dependencies> <!--see dependencies/dependency         
     Elements--> <dependency> ... </dependency> </dependencies> <!--whether any configuration is propagated to subprojects--> <inherited/> <!--as a configuration of Dom objects--> <configuratio n/> </plugin> </plugins> </pluginManagement> <!--the list of plug-ins used--> &L T;plugins> <!--See build/pluginmanagement/plugins/plugin elements--> <plugin> <groupId/> <artifactid/><version/><extensions/> <executions> <execution> &LT;ID/&GT;&LT;PHASE/&GT;&L t;goals/><inherited/><configuration/> </execution> </executions> <d Ependencies> <!--See dependencies/dependency elements--> <dependency> ... &l T;/dependency> </dependencies> <goals/><inherited/><configuration/> < /plugin> </plugins> </build>
Reporting

This element describes the specification for using a report plug-in to produce a report. These reports run when the user executes the MVN site. You can see links to all the reports in the page navigation bar.

<reporting> <!--True, the Web site does not include the default report. This includes the report from the Project information menu. --> <excludeDefaults/> <!--where all the resulting reports are stored. The default value is ${project.build.directory}/site. --> <outputDirectory/> <!--use the report Plug-ins and their configuration.  --> <plugins> <!--plugin element contains information that describes the requirements of a report plug-in--> <plugin> <!--report Plugin group in the warehouse Id--> <groupId/> <!--report plugin in the warehouse artifact id--> <artifactId/> <!--was made Version of the report plug-in used (or version range)--> <version/> <!--any configuration is propagated to subprojects--> <inherited/> < !--Report Plug-in configuration--> <configuration/> <!--a set of multiple specifications for a group of reports, each of which may have different configurations. A specification (a report set) corresponds to an execution target. For example, there are 1,2,3,4,5,6,7,8,9 reports. 1,2,5 constitutes a report set, corresponding to an execution target. 2,5,8 constitutes a B-report set, corresponding to another execution target--> <reportSets> <!--represents a collection of reports, and the configuration that produces the collection--> &LT;REPORTSET&G    
      T <!--a unique identifier for a collection of reports that is used when Pom inherits the--> <id/> <!--The configuration of the report used when generating the report collection--> <configurAtion/> <!--configuration is inherited to the poms--> <inherited/> <!--which reports are used in this collection-->    
 <reports/> </reportSet> </reportSets> </plugin> </plugins> </reporting>
5. Project Information

Name: Provide a more user-friendly project name to the user
Description: Project description, saved in MAVEN documentation
URL: Save in Url,maven document for home page
Inceptionyear: Year of Project creation, 4 digits. This value is used when generating copyright information
Licenses: This element describes all license lists for the project. You should list only the license of the item, not the license list of dependent items. If multiple license are listed, the user can select one of them instead of accepting all license. Following

<license>    
    <!--license used in legal name-->    
    <name>...</name>     
    <!-- The main way to distribute url--> <url>....</url> <!--The official License Body page
    : Repo, can download manual from the MAVEN library, Users must manually download and install dependent-->    
    <distribution>repo</distribution>     
    <!--additional information on license-->    
    < Comments>....</comments>     

Organization:1.name Organization name 2.url Organization Homepage URL
Developers: List of project developers (as follows)
Contributors: List of other contributors to the project, with developers

<developers> <!--A developer information--> <developer> <!--Developer's unique identifier--> &LT;ID&GT; .. </id> <!--Developer's full name--> <name>...</name> <!--Developer's email--> &L T;email>...</email> <!--Developer's homepage--> <url>...<url/> <!--Developer's role in the project--&
        Gt <roles> <role>java dev</role> <role>web ui</role> < /roles> <!--developer-owned organization--> <organization>sun</organization> <!--developer Organization of Ur L--> <organizationUrl>...</organizationUrl> <!--developer properties such as instant Messaging how to handle--> <pro Perties> <!--and the properties in the Main tab, you can define the sub tags--> </properties> <!--Developer's time zone,- Integers in the range 11 through 12.   --> <timezone>-5</timezone> </developer> </developers>
6. Environment Setting

Issuemanagement

The name and URL of the purpose Problem management system (Bugzilla, Jira, Scarab)

<issueManagement>
    <system>Bugzilla</system>
    <url>http://127.0.0.1/bugzilla/ </url>
</issueManagement>

System: Systems Type
URL: Path
Cimanagement

Continuous integration information for a project

<ciManagement>
    <system>continuum</system>
    <url>http://127.0.0.1:8080/continuum </url>
    <notifiers>
      <notifier>
        <type>mail</type>
        <sendonerror >true</sendOnError>
        <sendOnFailure>true</sendOnFailure>
        <sendOnSuccess> false</sendonsuccess>
        <sendOnWarning>false</sendOnWarning>
        <address> continuum@127.0.0.1</address>
        <configuration></configuration>
      </notifier>
    </notifiers>
  </ciManagement>

System: The name of the continuous integration systems
URL: URL of the Continuous integration System
Notifiers: The developer/User Configuration item that needs to be notified when the build is complete. Includes the notified person information and the notification condition (error, failure, success, warning)
Type: Notification mode
Sendonerror: Notify if error
Sendonfailure: Whether to notify when failure
Sendonsuccess: Whether to notify when successful
Sendonwarning: Notify when warning
Address: The addresses to which notifications are sent
Configuration: Extension Items
MailingLists

Project related Mailing list information

<mailinglists> <mailingList> <name>user list</name> <s Ubscribe>user-subscribe@127.0.0.1</subscribe> <unsubscribe>user-unsubscribe@127.0.0.1</

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.