使用的缺陷跟踪系统(Bugzilla,TestTrack,ClearQuest,等)信息,主要用于产生项目文档。
<issueManagement> <system>Bugzilla</system> <url>http://127.0.0.1/bugzilla/</url> </issueManagement>
持续构建系统配置。
<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> <configuration><address>[email protected]</address></configuration> </notifier> </notifiers> </ciManagement>notifiers:定义当出现构建状态时需要通知的人,已经通知的方式。
定义了该项目需要保持联系的人员,主要是开发人员和用户的邮件列表。
<mailingLists> <mailingList> <name>User List</name> <subscribe>[email protected]</subscribe> <unsubscribe>[email protected]</unsubscribe> <post>[email protected]</post> <archive>http://127.0.0.1/user/</archive> <otherArchives> <otherArchive>http://base.google.com/base/1/127.0.0.1</otherArchive> </otherArchives> </mailingList> </mailingLists>1)subscribe、unsubscribe:执行对应行为指定的邮件地址。如为了订阅上面用户的,一个用户需要发送email到[email protected];
SCM:Software Configuration Management,也称作Source Code/Control Management简洁的成为version control。
这里是你存放版本管理信息到POM的地方。
<scm> <connection>scm:svn:http://127.0.0.1/svn/my-project</connection> <developerConnection>scm:svn:https://127.0.0.1/svn/my-project</developerConnection> <tag>HEAD</tag> <url>http://127.0.0.1/websvn/my-project</url> </scm>1)connection:要求对源代码有读的权限,可以更新;developerConnection:要求对源代码有写的权限,可以提交代码;
为了让该POM正确的执行所需要的先决条件,这里是你定义先决条件的地方。如果不满足这些先决条件,Maven将不会开始。目前只有maven的最小版本号一个先决条件。
<prerequisites> <maven>2.0.6</maven> </prerequisites>
定义Maven的仓库地址,在Super POM中已经定义了Maven的默认仓库中心http://repo.maven.apache.org/maven2(见Super POM)。
<repositories> <repository> <releases> <enabled>false</enabled> <updatePolicy>always</updatePolicy> <checksumPolicy>warn</checksumPolicy> </releases> <snapshots> <enabled>true</enabled> <updatePolicy>never</updatePolicy> <checksumPolicy>fail</checksumPolicy> </snapshots> <id>codehausSnapshots</id> <name>Codehaus Snapshots</name> <url>http://snapshots.maven.codehaus.org/maven2</url> <layout>default</layout> </repository> </repositories> <pluginRepositories> ... </pluginRepositories>1)releases、snapshots:针对组件的发布类型能干采取的策略(release或者snapshot);
管理build生成的组件和资源文件和分发。
<distributionManagement> ... <downloadUrl>http://mojo.codehaus.org/my-project</downloadUrl> <status>deployed</status> </distributionManagement>downloadUrl:另一个POM配置用于获取该POM的组件的仓库的url;
distributionManagement通过repository定义当组件部署时,项目可以从哪里(和怎么)获取远端仓库。
<distributionManagement> <repository> <uniqueVersion>false</uniqueVersion> <id>corp1</id> <name>Corporate Repository</name> <url>scp://repo/maven2</url> <layout>default</layout> </repository> <snapshotRepository> <uniqueVersion>true</uniqueVersion> <id>propSnap</id> <name>Propellors Snapshots</name> <url>sftp://propellers.net/maven</url> <layout>legacy</layout> </snapshotRepository> ... </distributionManagement>id:仓库的唯一标识;
比起分发到仓库,distributionManagement更多的运用是定义怎么部署项目的站点和文档。
<distributionManagement> ... <site> <id>mojo.website</id> <name>Mojo Website</name> <url>scp://beaver.codehaus.org/home/projects/mojo/public_html/</url> </site> ... </distributionManagement>
<distributionManagement> ... <relocation> <groupId>org.apache</groupId> <artifactId>my-project</artifactId> <version>1.0</version> <message>We have moved the Project under Apache</message> </relocation> ... </distributionManagement>项目在发展的过程中,可能被迫转移到其它更适合的地方。relocation用于给项目的用户指名该项目被重命名为什么(例如上面,项目被重命名到org.apache:my-project:1.0),除此之外,它还提供一个项目转移的解释。
POM 4.0的一个新特征是改变项目被构建的环境的settings的能力。
<profiles> <profile> <id>test</id> <activation>...</activation> <build>...</build> <modules>...</modules> <repositories>...</repositories> <pluginRepositories>...</pluginRepositories> <dependencies>...</dependencies> <reporting>...</reporting> <dependencyManagement>...</dependencyManagement> <distributionManagement>...</distributionManagement> </profile> </profiles>
Activation是profile的关键。一个profile的威力来自于在当前的环境下修改基本POM的能力。
<profiles> <profile> <id>test</id> <activation> <activeByDefault>false</activeByDefault> <jdk>1.5</jdk> <os> <name>Windows XP</name> <family>Windows</family> <arch>x86</arch> <version>5.1.2600</version> </os> <property> <name>sparrow-type</name> <value>African</value> </property> <file> <exists>${basedir}/file2.properties</exists> <missing>${basedir}/file1.properties</missing> </file> </activation> ... </profile> </profiles>jdk:如果jdk版本号匹配被给的前缀,则profile被激活,例如:1.5.0_06将匹配上面的配置;