`

Maven POM.xml详解

阅读更多

 

    

    POM.xml文件: pom作为项目对象模型。通过xml表示maven项目,使用pom.xml来实现。主要描述了项目:包括配置文件;开发者需要遵循的规则,缺陷管理系统,组织和licenses,项目的url,项目的依赖性,以及其他所有的项目相关因素。

   

 

<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/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<artifactId>Amway_Parent</artifactId>
		<groupId>com.amway</groupId>
		<version>4.0.0</version>
		<relativePath>../Amway_Parent/pom.xml</relativePath>
	</parent>
	<groupId>com.amway.site</groupId>
	<artifactId>Amway_Amanet</artifactId>
	<packaging>war</packaging>
	<version>4.0.0</version>
	<name>Amway Amanet Maven Webapp</name>
	<dependencies>
		<dependency>
			<groupId>com.amway.site</groupId>
			<artifactId>Amway_Website_Common</artifactId>
		</dependency>

		<dependency>
			<groupId>com.amway</groupId>
			<artifactId>Amway_Core</artifactId>
		</dependency>

		<dependency>
			<groupId>com.amway</groupId>
			<artifactId>Amway_Payment_Common</artifactId>
		</dependency>

		<dependency>
			<groupId>com.amway.pos5g</groupId>
			<artifactId>Amway_WS_5gPOS_API</artifactId>
		</dependency>

		<dependency>
			<groupId>com.amway</groupId>
			<artifactId>Amway_WS_5gPOS_Client</artifactId>
		</dependency>



		<!-- ====== spring framework ======== -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-core</artifactId>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-beans</artifactId>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context</artifactId>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-aop</artifactId>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-web</artifactId>
		</dependency>
		<!--== spring end -->

		<!-- ====== cxf framework ======== -->
		<dependency>
			<groupId>org.apache.cxf</groupId>
			<artifactId>cxf-api</artifactId>
		</dependency>

		<dependency>
			<groupId>org.apache.cxf</groupId>
			<artifactId>cxf-rt-transports-http</artifactId>
		</dependency>
		<dependency>
			<groupId>org.apache.cxf</groupId>
			<artifactId>cxf-rt-core</artifactId>
		</dependency>
		<dependency>
			<groupId>org.apache.cxf</groupId>
			<artifactId>cxf-rt-frontend-jaxws</artifactId>
		</dependency>
		<dependency>
			<groupId>org.apache.cxf</groupId>
			<artifactId>cxf-rt-frontend-simple</artifactId>
		</dependency>
		<dependency>
			<groupId>org.apache.cxf</groupId>
			<artifactId>cxf-rt-databinding-jaxb</artifactId>
		</dependency>
		<dependency>
			<groupId>org.apache.cxf</groupId>
			<artifactId>cxf-rt-bindings-soap</artifactId>
		</dependency>
		<dependency>
			<groupId>com.sun.xml.bind</groupId>
			<artifactId>jaxb-impl</artifactId>
		</dependency>
		<dependency>
			<groupId>wsdl4j</groupId>
			<artifactId>wsdl4j</artifactId>
		</dependency>

		<dependency>
			<groupId>org.codehaus.woodstox</groupId>
			<artifactId>stax2-api</artifactId>
		</dependency>

		<dependency>
			<groupId>org.codehaus.woodstox</groupId>
			<artifactId>wstx-asl</artifactId>
		</dependency>

		<dependency>
			<groupId>org.apache.geronimo.specs</groupId>
			<artifactId>geronimo-jaxws_2.2_spec</artifactId>
		</dependency>

		<dependency>
			<groupId>org.apache.geronimo.specs</groupId>
			<artifactId>geronimo-stax-api_1.0_spec</artifactId>
		</dependency>

		<dependency>
			<groupId>org.apache.geronimo.specs</groupId>
			<artifactId>geronimo-ws-metadata_2.0_spec</artifactId>
		</dependency>

		<dependency>
			<groupId>org.apache.geronimo.specs</groupId>
			<artifactId>geronimo-annotation_1.0_spec</artifactId>
		</dependency>

		<dependency>
			<groupId>org.apache.ws.xmlschema</groupId>
			<artifactId>xmlschema-core</artifactId>
		</dependency>

		<dependency>
			<groupId>xml-resolver</groupId>
			<artifactId>xml-resolver</artifactId>
		</dependency>

		<dependency>
			<groupId>javax.xml.soap</groupId>
			<artifactId>saaj-api</artifactId>
		</dependency>

		<dependency>
			<groupId>com.sun.xml.messaging.saaj</groupId>
			<artifactId>saaj-impl</artifactId>
		</dependency>

		<dependency>
			<groupId>org.apache.neethi</groupId>
			<artifactId>neethi</artifactId>
		</dependency>
		<!-- ====== java container library ======== -->

		<dependency>
			<groupId>javax.xml.bind</groupId>
			<artifactId>jaxb-api</artifactId>
		</dependency>

		<!-- === tool lib -->

		<dependency>
			<groupId>opensymphony</groupId>
			<artifactId>oscache</artifactId>
		</dependency>

		<dependency>
			<groupId>commons-httpclient</groupId>
			<artifactId>commons-httpclient</artifactId>
		</dependency>

		<dependency>
			<groupId>com.wiz.enets2</groupId>
			<artifactId>umapi</artifactId>
		</dependency>

		<dependency>
			<groupId>org.directwebremoting</groupId>
			<artifactId>dwr</artifactId>
		</dependency>

		<dependency>
			<groupId>org.apache.velocity</groupId>
			<artifactId>velocity</artifactId>
		</dependency>

		<dependency>
			<groupId>jstl</groupId>
			<artifactId>jstl</artifactId>
		</dependency>

		<dependency>
			<groupId>taglibs</groupId>
			<artifactId>standard</artifactId>
		</dependency>
		
		<dependency>
			<groupId>org.owasp.antisamy</groupId>
			<artifactId>antisamy</artifactId>
		</dependency>
	</dependencies>

	<profiles>
		<profile>
			<id>local</id>
			<activation>
				<activeByDefault>true</activeByDefault>
			</activation>
			<properties>
				<maven.test.skip>true</maven.test.skip>
				<maven.javadoc.skip>true</maven.javadoc.skip>
				<build.profile.id>local</build.profile.id>
			</properties>
			<build>
				<filters>
					<filter>env.${build.profile.id}.properties</filter>
					<filter>buildNumber.properties</filter>
				</filters>
				<resources>
					<resource>
						<directory>src/main/resources</directory>
						<includes>
							<include>**/*.properties</include>
							<include>**/*.xml</include>
						</includes>
						<filtering>true</filtering>
					</resource>
				</resources>
			</build>
		</profile>
		<profile>
			<id>dev</id>
			<activation>
				<activeByDefault>false</activeByDefault>
			</activation>
			<properties>
				<maven.test.skip>true</maven.test.skip>
				<maven.javadoc.skip>true</maven.javadoc.skip>
				<build.profile.id>dev</build.profile.id>
			</properties>
			<build>
				<filters>
					<filter>env.${build.profile.id}.properties</filter>
					<filter>buildNumber.properties</filter>
				</filters>
				<resources>
					<resource>
						<directory>src/main/resources</directory>
						<includes>
							<include>**/*.properties</include>
							<include>**/*.xml</include>
						</includes>
						<filtering>true</filtering>
					</resource>
				</resources>
			</build>
		</profile>
		<profile>
			<id>qa</id>
			<activation>
				<activeByDefault>false</activeByDefault>
			</activation>
			<properties>
				<build.profile.id>qa</build.profile.id>
				<maven.test.failure.ignore>false</maven.test.failure.ignore>
			</properties>
			<build>
				<filters>
					<filter>env.${build.profile.id}.properties</filter>
					<filter>buildNumber.properties</filter>
				</filters>
				<resources>
					<resource>
						<directory>src/main/resources</directory>
						<includes>
							<include>**/*.properties</include>
							<include>**/*.xml</include>
						</includes>
						<filtering>true</filtering>
					</resource>
				</resources>
			</build>
		</profile>
		<profile>
			<id>prod</id>
			<activation>
				<activeByDefault>false</activeByDefault>
			</activation>
			<properties>
				<build.profile.id>prod</build.profile.id>
				<maven.test.failure.ignore>false</maven.test.failure.ignore>
			</properties>
			<build>
				<filters>
					<filter>env.${build.profile.id}.properties</filter>
					<filter>buildNumber.properties</filter>
				</filters>
				<resources>
					<resource>
						<directory>src/main/resources</directory>
						<includes>
							<include>**/*.properties</include>
							<include>**/*.xml</include>
						</includes>
						<filtering>true</filtering>
					</resource>
				</resources>
			</build>
		</profile>
	</profiles>
	<url>www.amway.com.hk/amanet</url>
	<build>
		<finalName>Amway_Amanet</finalName>
		<plugins>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>tomcat-maven-plugin</artifactId>
				<configuration>
					<uriEncoding>utf-8</uriEncoding>
					<path>/amanet</path>
					<update>true</update>
					<url>${tomcat.manager.url}</url>
					<server>tomcat</server>
					<username>${tomcat.manager.username}</username>
					<password>${tomcat.manager.password}</password>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.mortbay.jetty</groupId>
				<artifactId>maven-jetty-plugin</artifactId>
				<version>6.1.10</version>
			</plugin>
		</plugins>

	</build>
</project>

  

 parent

给出父项目的位置,如果存在上一级父项目的话。

如果没有特别指出的话,值就是父项目对于当前项目而言。

位置是一个 as a group ID, artifact ID 和version元素的组合。

 

modelVersion

描述这个POM文件遵从哪个版本的项目描述符。

 

groupId

针对一个项目的普遍唯一识别符。通常用一个完全正确的包的名字来与其他项目的类似名字来进行区分(比如:org.apache.maven)

 

artifactId

在给定groupID 的group里面为artifact 指定的标识符是唯一的 artifact 代表的是被制作或者被一个project应用的组件。

对于Maven项目的artifact 的例子包括:一些JARs, 原代码以及二进制的发布以及WARs.。

 

packaging:

这个项目生产出来的artifact 类型,举个例子 jar war  pom Plugins 能够创建他们自己的包,包括包的类型,所以这个列表不可能包含所有可能的类型。

 

name:

当前项目的全称。

 

version:

当前项目产生的artifact的当前版本。

 

description

当前项目的一个细节描述,当需要描述这个项目的时候被Maven所用,比如在web 站点中。

这个元素能够被指定为CDATA 类型,允许在描述器中 HTML的tags, 并不鼓励用空白文本来表示。

如果你需要去修改生成的web 站点的索引页,你能够用你自己的索引来代替自动生成的文本。

 

url

当前项目的主页的URL。

 

prerequisites:

描述当前项目的编译环境的先决条件。

 

issueManagement:

当前项目的发布管理信息。

 

ciManagement :

当前项目的连续集成信息。

 

inceptionYear

当前项目开始的年份, 用4位数字描述。 涉及到介绍情况时用作提供版权信息。

 

mailingLists

包含的信息包括邮件列表。

 

developers:

描述当前的项目的开发人员的信息。

 

contributors:

描述对当前项目有贡献的人员的信息,不特指开发人员。

 

licenses

这个元素描述了当前项目的所有的许可文件。每一个许可文件用一个许可元素来描述,然后描述额外的元素。

通常只列出适用于这个项目的许可文件以及适用于 依赖的非licenses.如果多个licenses都列出来了,那么假设这个用户选择其中的所需的,而不是接受所有的许可文件。

 

scm:

指定当前项目中的版本控制工具,比如CVS, Subversion, 等等。

 

organization

这个元素描述这个项目所属组织的各种属性的描述。这些属性应用于文档创建的时候 (版权通知和链接)。

 

build:

创建项目时必须的信息。

 

profiles:

本地项目编译档案文件时的列表,被激活时会修改build的过程。

<activeByDefault>true</activeByDefault>activeByDefault为true表示

当前profile被使用和激活

 

modules:

模块 (有时被叫做子项目)作为当前项目的一部分。每一个被列出来的子模块都指向包含这个模块的目录文件的相对路径。

 

repositories

发现依赖和扩展的远程资源库。

 

pluginRepositories:

发现plugins 的远程资源库的列表,主要是为了编译和报告。

 

dependencies:

这个元素描述了所有与当前项目相关的依赖。

这些依赖被用作创建一个编译时的路径。

他们被自动的从资源库中下在下来依据当前项目的定义。如需更多信息,参看 the dependency mechanism reports     Deprecated.禁止适用。

现在的版本中被 Maven所忽略掉。

reporting:

这个元素包括报告的plugins 的指定,用作Maven生成站点的自动生成报告。这些报告将会运行当用户执行mvn site. 所有的报告将会包括在浏览器的导航栏中。

 

dependencyManagement:

缺省的依赖信息将会从这个元素中继承。这些依赖在这一部分中被不立刻被解决的。

当一个源于这个POM的元素描述了一个依赖根据匹配的 groupId 和 artifactId,这个部分的版本和其他值用作那些还没有指定的依赖。

 

distributionManagement:

对于一个项目分配的信息允许对于远程web服务器和资源库的site和artifacts配置。

 

properties

属性可以作为POM的自始自终的替换物,如果可行的话可以用作resources 的过滤器,格式是

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics