分享

Maven POM

 figol 2006-10-17

Maven

This is a reference for the Maven project descriptor used in Maven.

An XSD is available at:

<project>
<parent>
<artifactId/>
<groupId/>
<version/>
<relativePath/>
</parent>
<modelVersion/>
<groupId/>
<artifactId/>
<packaging/>
<name/>
<version/>
<description/>
<url/>
<prerequisites>
<maven/>
</prerequisites>
<issueManagement>
<system/>
<url/>
</issueManagement>
<ciManagement>
<system/>
<url/>
<notifiers>
<notifier>
<type/>
<sendOnError/>
<sendOnFailure/>
<sendOnSuccess/>
<sendOnWarning/>
<address/>
<configuration/>
</notifier>
</notifiers>
</ciManagement>
<inceptionYear/>
<mailingLists>
<mailingList>
<name/>
<subscribe/>
<unsubscribe/>
<post/>
<archive/>
<otherArchives/>
</mailingList>
</mailingLists>
<developers>
<developer>
<id/>
<name/>
<email/>
<url/>
<organization/>
<organizationUrl/>
<roles/>
<timezone/>
<properties/>
</developer>
</developers>
<contributors>
<contributor>
<name/>
<email/>
<url/>
<organization/>
<organizationUrl/>
<roles/>
<timezone/>
<properties/>
</contributor>
</contributors>
<licenses>
<license>
<name/>
<url/>
<distribution/>
<comments/>
</license>
</licenses>
<scm>
<connection/>
<developerConnection/>
<tag/>
<url/>
</scm>
<organization>
<name/>
<url/>
</organization>
<build>
<sourceDirectory/>
<scriptSourceDirectory/>
<testSourceDirectory/>
<outputDirectory/>
<testOutputDirectory/>
<extensions>
<extension>
<groupId/>
<artifactId/>
<version/>
</extension>
</extensions>
<defaultGoal/>
<resources>
<resource>
<targetPath/>
<filtering/>
<directory/>
<includes/>
<excludes/>
</resource>
</resources>
<testResources>
<testResource>
<targetPath/>
<filtering/>
<directory/>
<includes/>
<excludes/>
</testResource>
</testResources>
<directory/>
<finalName/>
<filters/>
<pluginManagement>
<plugins>
<plugin>
<groupId/>
<artifactId/>
<version/>
<extensions/>
<executions>
<execution>
<id/>
<phase/>
<goals/>
<inherited/>
<configuration/>
</execution>
</executions>
<dependencies>
<dependency>
<groupId/>
<artifactId/>
<version/>
<type/>
<classifier/>
<scope/>
<systemPath/>
<exclusions>
<exclusion>
<artifactId/>
<groupId/>
</exclusion>
</exclusions>
<optional/>
</dependency>
</dependencies>
<goals/>
<inherited/>
<configuration/>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId/>
<artifactId/>
<version/>
<extensions/>
<executions>
<execution>
<id/>
<phase/>
<goals/>
<inherited/>
<configuration/>
</execution>
</executions>
<dependencies>
<dependency>
<groupId/>
<artifactId/>
<version/>
<type/>
<classifier/>
<scope/>
<systemPath/>
<exclusions>
<exclusion>
<artifactId/>
<groupId/>
</exclusion>
</exclusions>
<optional/>
</dependency>
</dependencies>
<goals/>
<inherited/>
<configuration/>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id/>
<activation>
<activeByDefault/>
<jdk/>
<os>
<name/>
<family/>
<arch/>
<version/>
</os>
<property>
<name/>
<value/>
</property>
<file>
<missing/>
<exists/>
</file>
</activation>
<build>
<defaultGoal/>
<resources>
<resource>
<targetPath/>
<filtering/>
<directory/>
<includes/>
<excludes/>
</resource>
</resources>
<testResources>
<testResource>
<targetPath/>
<filtering/>
<directory/>
<includes/>
<excludes/>
</testResource>
</testResources>
<directory/>
<finalName/>
<filters/>
<pluginManagement>
<plugins>
<plugin>
<groupId/>
<artifactId/>
<version/>
<extensions/>
<executions>
<execution>
<id/>
<phase/>
<goals/>
<inherited/>
<configuration/>
</execution>
</executions>
<dependencies>
<dependency>
<groupId/>
<artifactId/>
<version/>
<type/>
<classifier/>
<scope/>
<systemPath/>
<exclusions>
<exclusion>
<artifactId/>
<groupId/>
</exclusion>
</exclusions>
<optional/>
</dependency>
</dependencies>
<goals/>
<inherited/>
<configuration/>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId/>
<artifactId/>
<version/>
<extensions/>
<executions>
<execution>
<id/>
<phase/>
<goals/>
<inherited/>
<configuration/>
</execution>
</executions>
<dependencies>
<dependency>
<groupId/>
<artifactId/>
<version/>
<type/>
<classifier/>
<scope/>
<systemPath/>
<exclusions>
<exclusion>
<artifactId/>
<groupId/>
</exclusion>
</exclusions>
<optional/>
</dependency>
</dependencies>
<goals/>
<inherited/>
<configuration/>
</plugin>
</plugins>
</build>
<modules/>
<repositories>
<repository>
<releases>
<enabled/>
<updatePolicy/>
<checksumPolicy/>
</releases>
<snapshots>
<enabled/>
<updatePolicy/>
<checksumPolicy/>
</snapshots>
<id/>
<name/>
<url/>
<layout/>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<releases>
<enabled/>
<updatePolicy/>
<checksumPolicy/>
</releases>
<snapshots>
<enabled/>
<updatePolicy/>
<checksumPolicy/>
</snapshots>
<id/>
<name/>
<url/>
<layout/>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId/>
<artifactId/>
<version/>
<type/>
<classifier/>
<scope/>
<systemPath/>
<exclusions>
<exclusion>
<artifactId/>
<groupId/>
</exclusion>
</exclusions>
<optional/>
</dependency>
</dependencies>
<reports/>
<reporting>
<excludeDefaults/>
<outputDirectory/>
<plugins>
<plugin>
<groupId/>
<artifactId/>
<version/>
<inherited/>
<configuration/>
<reportSets>
<reportSet>
<id/>
<configuration/>
<inherited/>
<reports/>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
<dependencyManagement>
<dependencies>
<dependency>
<groupId/>
<artifactId/>
<version/>
<type/>
<classifier/>
<scope/>
<systemPath/>
<exclusions>
<exclusion>
<artifactId/>
<groupId/>
</exclusion>
</exclusions>
<optional/>
</dependency>
</dependencies>
</dependencyManagement>
<distributionManagement>
<repository>
<uniqueVersion/>
<id/>
<name/>
<url/>
<layout/>
</repository>
<snapshotRepository>
<uniqueVersion/>
<id/>
<name/>
<url/>
<layout/>
</snapshotRepository>
<site>
<id/>
<name/>
<url/>
</site>
<downloadUrl/>
<relocation>
<groupId/>
<artifactId/>
<version/>
<message/>
</relocation>
<status/>
</distributionManagement>
<properties/>
</profile>
</profiles>
<modules/>
<repositories>
<repository>
<releases>
<enabled/>
<updatePolicy/>
<checksumPolicy/>
</releases>
<snapshots>
<enabled/>
<updatePolicy/>
<checksumPolicy/>
</snapshots>
<id/>
<name/>
<url/>
<layout/>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<releases>
<enabled/>
<updatePolicy/>
<checksumPolicy/>
</releases>
<snapshots>
<enabled/>
<updatePolicy/>
<checksumPolicy/>
</snapshots>
<id/>
<name/>
<url/>
<layout/>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId/>
<artifactId/>
<version/>
<type/>
<classifier/>
<scope/>
<systemPath/>
<exclusions>
<exclusion>
<artifactId/>
<groupId/>
</exclusion>
</exclusions>
<optional/>
</dependency>
</dependencies>
<reports/>
<reporting>
<excludeDefaults/>
<outputDirectory/>
<plugins>
<plugin>
<groupId/>
<artifactId/>
<version/>
<inherited/>
<configuration/>
<reportSets>
<reportSet>
<id/>
<configuration/>
<inherited/>
<reports/>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
<dependencyManagement>
<dependencies>
<dependency>
<groupId/>
<artifactId/>
<version/>
<type/>
<classifier/>
<scope/>
<systemPath/>
<exclusions>
<exclusion>
<artifactId/>
<groupId/>
</exclusion>
</exclusions>
<optional/>
</dependency>
</dependencies>
</dependencyManagement>
<distributionManagement>
<repository>
<uniqueVersion/>
<id/>
<name/>
<url/>
<layout/>
</repository>
<snapshotRepository>
<uniqueVersion/>
<id/>
<name/>
<url/>
<layout/>
</snapshotRepository>
<site>
<id/>
<name/>
<url/>
</site>
<downloadUrl/>
<relocation>
<groupId/>
<artifactId/>
<version/>
<message/>
</relocation>
<status/>
</distributionManagement>
<properties/>
</project>

project

The <project> element is the root of the descriptor. The following table lists all of the possible child elements.

Element Description
parent The location of the parent project, if one exists. Values from the parent project will be the default for this project if they are left unspecified. The location is given as a group ID, artifact ID and version.
modelVersion Declares to which version of project descriptor this POM conforms.
groupId A universally unique identifier for a project. It is normal to use a fully-qualified package name to distinguish it from other projects with a similar name (eg. org.apache.maven).
artifactId The identifier for this artifact that is unique within the group given by the group ID. An artifact is something that is either produced or used by a project. Examples of artifacts produced by Maven for a project include: JARs, source and binary distributions, and WARs.
packaging The type of artifact this project produces, for example jar war ear pom. Plugins can create their own packaging, and therefore their own packaging types, so this list does not contain all possible types.
name The full name of the project.
version The current version of the artifact produced by this project.
description A detailed description of the project, used by Maven whenever it needs to describe the project, such as on the web site. While this element can be specified as CDATA to enable the use of HTML tags within the description, it is discouraged to allow plain text representation. If you need to modify the index page of the generated web site, you are able to specify your own instead of adjusting this text.
url The URL to the project‘s homepage.
prerequisites Describes the prerequisites in the build environment for this project.
issueManagement The project‘s issue management system information.
ciManagement The project‘s continuous integration information.
inceptionYear The year of the project‘s inception, specified with 4 digits. This value is used when generating copyright notices as well as being informational.
mailingLists Contains information about a project‘s mailing lists.
developers Describes the committers of a project.
contributors Describes the contributors to a project that are not yet committers.
licenses This element describes all of the licenses for this project. Each license is described by a license element, which is then described by additional elements. Projects should only list the license(s) that applies to the project and not the licenses that apply to dependencies. If multiple licenses are listed, it is assumed that the user can select any of them, not that they must accept all.
scm Specification for the SCM used by the project, such as CVS, Subversion, etc.
organization This element describes various attributes of the organization to which the project belongs. These attributes are utilized when documentation is created (for copyright notices and links).
build Information required to build the project.
profiles A listing of project-local build profiles which will modify the build process when activated.
modules The modules (sometimes called subprojects) to build as a part of this project. Each module listed is a relative path to the directory containing the module.
repositories The lists of the remote repositories for discovering dependencies and extensions.
pluginRepositories The lists of the remote repositories for discovering plugins for builds and reports.
dependencies This element describes all of the dependencies associated with a project. These dependencies are used to construct a classpath for your project during the build process. They are automatically downloaded from the repositories defined in this project. See the dependency mechanism for more information.
reports Deprecated. Now ignored by Maven.
reporting This element includes the specification of report plugins to use to generate the reports on the Maven-generated site. These reports will be run when a user executes mvn site. All of the reports will be included in the navigation bar for browsing.
dependencyManagement Default dependency information for projects that inherit from this one. The dependencies in this section are not immediately resolved. Instead, when a POM derived from this one declares a dependency described by a matching groupId and artifactId, the version and other values from this section are used for that dependency if they were not already specified.
distributionManagement Distribution information for a project that enables deployment of the site and artifacts to remote web servers and repositories respectively.
properties Properties that can be used throughout the POM as a substitution, and are used as filters in resources if enabled. The format is <name>value</name>.

parent

Element Description
artifactId The artifact id of the parent project to inherit from.
groupId The group id of the parent project to inherit from.
version The version of the parent project to inherit.
relativePath The relative path of the parent pom.xml file within the check out. The default value is ../pom.xml. Maven looks for the parent pom first in the reactor of currently building projects, then in this location on the filesystem, then the local repository, and lastly in the remote repo. relativePath allows you to select a different location, for example when your structure is flat, or deeper without an intermediate parent pom. However, the group ID, artifact ID and version are still required, and must match the file in the location given or it will revert to the repository for the POM. This feature is only for enhancing the development in a local checkout of that project.

prerequisites

Describes the prerequisites a project can have.

Element Description
maven The minimum version of Maven required to build the project, or to use this plugin.

issueManagement

Information about the issue tracking (or bug tracking) system used to manage this project.

Element Description
system The name of the issue management system, e.g. Bugzilla
url URL for the issue management system used by the project.

ciManagement

Element Description
system The name of the continuous integration system, e.g. continuum.
url URL for the continuous integration system used by the project if it has a web interface.
notifiers Configuration for notifying developers/users when a build is unsuccessful, including user information and notification mode.

notifier

Configures one method for notifying users/developers when a build breaks.

Element Description
type The mechanism used to deliver notifications.
sendOnError Whether to send notifications on error.
sendOnFailure Whether to send notifications on failure.
sendOnSuccess Whether to send notifications on success.
sendOnWarning Whether to send notifications on warning.
address Deprecated. Where to send the notification to - eg email address.
configuration Extended configuration specific to this notifier goes here.

mailingList

This element describes all of the mailing lists associated with a project. The auto-generated site references this information.

Element Description
name The name of the mailing list.
subscribe The email address or link that can be used to subscribe to the mailing list. If this is an email address, a mailto: link will automatically be created when the documentation is created.
unsubscribe The email address or link that can be used to unsubscribe to the mailing list. If this is an email address, a mailto: link will automatically be created when the documentation is created.
post The email address or link that can be used to post to the mailing list. If this is an email address, a mailto: link will automatically be created when the documentation is created.
archive The link to a URL where you can browse the mailing list archive.
otherArchives The link to alternate URLs where you can browse the list archive.

developer

Information about one of the committers on this project.

Element Description
id The unique ID of the developer in the SCM.
name The full name of the contributor.
email The email address of the contributor.
url The URL for the homepage of the contributor.
organization The organization to which the contributor belongs.
organizationUrl The URL of the organization.
roles The roles the contributor plays in the project. Each role is described by a role element, the body of which is a role name. This can also be used to describe the contribution.
timezone The timezone the contributor is in. This is a number in the range -11 to 12.
properties Properties about the contributor, such as an instant messenger handle.

contributor

Description of a person who has contributed to the project, but who does not have commit privileges. Usually, these contributions come in the form of patches submitted.

Element Description
name The full name of the contributor.
email The email address of the contributor.
url The URL for the homepage of the contributor.
organization The organization to which the contributor belongs.
organizationUrl The URL of the organization.
roles The roles the contributor plays in the project. Each role is described by a role element, the body of which is a role name. This can also be used to describe the contribution.
timezone The timezone the contributor is in. This is a number in the range -11 to 12.
properties Properties about the contributor, such as an instant messenger handle.

license

Describes the licenses for this project. This is used to generate the license page of the project‘s web site, as well as being taken into consideration in other reporting and validation. The licenses listed for the project are that of the project itself, and not of dependencies.

Element Description
name The full legal name of the license.
url The official url for the license text.
distribution The primary method by which this project may be distributed.
repo
may be downloaded from the Maven repository
manual
user must manually download and install the dependency.
comments Addendum information pertaining to this license.

scm

Element Description
connection The source control management system URL that describes the repository and how to connect to the repository. For more information, see the URL format and list of supported SCMs. This connection is read-only.
developerConnection Just like connection, but for developers, i.e. this scm connection will not be read only.
tag The tag of current code. By default, it‘s set to HEAD during development.
url The URL to the project‘s browsable SCM repository, such as ViewVC or Fisheye.

organization

Specifies the organization that produces this project.

Element Description
name The full name of the organization.
url The URL to the organization‘s home page.

build

Element Description
sourceDirectory This element specifies a directory containing the source of the project. The generated build system will compile the source in this directory when the project is built. The path given is relative to the project descriptor.
scriptSourceDirectory This element specifies a directory containing the script sources of the project. This directory is meant to be different from the sourceDirectory, in that its contents will be copied to the output directory in most cases (since scripts are interpreted rather than compiled).
testSourceDirectory This element specifies a directory containing the unit test source of the project. The generated build system will compile these directories when the project is being tested. The path given is relative to the project descriptor.
outputDirectory The directory where compiled application classes are placed.
testOutputDirectory The directory where compiled test classes are placed.
extensions A set of build extensions to use from this project.
defaultGoal The default goal (or phase in Maven 2) to execute when none is specified for the project.
resources This element describes all of the classpath resources such as properties files associated with a project. These resources are often included in the final package.
testResources This element describes all of the classpath resources such as properties files associated with a project‘s unit tests.
directory The directory where all files generated by the build are placed.
finalName The filename (excluding the extension, and with no path information) that the produced artifact will be called. The default value is ${artifactId}-${version}.
filters The list of filter properties files that are used when filtering is enabled.
pluginManagement Default plugin information to be made available for reference by projects derived from this one. This plugin configuration will not be resolved or bound to the lifecycle unless referenced. Any local configuration for a given plugin will override the plugin‘s entire definition here.
plugins The list of plugins to use.

extension

Describes a build extension to utilise.

Element Description
groupId The group ID of the extension‘s artifact.
artifactId The artifact ID of the extension.
version The version of the extension.

resource

This element describes all of the classpath resources associated with a project or unit tests.

Element Description
targetPath Describe the resource target path. For example, if you want that resource to appear in a specific package (org.apache.maven.messages), you must specify this element with this value: org/apache/maven/messages. This is not required if you simply

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多