1. 程式人生 > >Maven的pom.xml檔案詳解④Environment Settings

Maven的pom.xml檔案詳解④Environment Settings

Issue Management

使用的缺陷跟蹤系統(BugzillaTestTrackClearQuest,等)資訊,主要用於產生專案文件。

  1. <issueManagement>
  2. <system>Bugzilla</system>
  3. <url>http://127.0.0.1/bugzilla/</url>
  4. </issueManagement>

Continuous Integration Management

持續構建系統配置。

  1. <ciManagement>
  2. <system>continuum</system>
  3. <url>http://127.0.0.1:8080/continuum</url>
  4. <notifiers>
  5. <notifier>
  6. <type>mail</type>
  7. <sendOnError>true</sendOnError>
  8. <sendOnFailure>true</sendOnFailure>
  9. <sendOnSuccess>false</sendOnSuccess>
  10. <sendOnWarning>false</sendOnWarning>
  11. <configuration><address>
    [email protected]</address></configuration>
  12. </notifier>
  13. </notifiers>
  14. </ciManagement>

notifiers:定義當出現構建狀態時需要通知的人,已經通知的方式。

Mailing Lists

定義了該專案需要保持聯絡的人員,主要是開發人員和使用者的郵件列表。

  1. <mailingLists>
  2. <mailingList>
  3. <name>User List</name>
  4. <subscribe>[email protected]
    </subscribe>
  5. <unsubscribe>[email protected]</unsubscribe>
  6. <post>[email protected]</post>
  7. <archive>http://127.0.0.1/user/</archive>
  8. <otherArchives>
  9. <otherArchive>http://base.google.com/base/1/127.0.0.1</otherArchive>
  10. </otherArchives>
  11. </mailingList>
  12. </mailingLists>
  • subscribe、unsubscribe:執行對應行為指定的郵件地址。如為了訂閱上面使用者的,一個使用者需要傳送email到[email protected]
  • archive:已歸檔的郵件列表郵件的url,如果有映象歸檔地址,則指定到otherArchives中;
  • post:post到郵件列表的郵件地址。

SCM

SCM:Software Configuration Management,也稱作Source Code/Control Management簡潔的成為version control。 
這裡是你存放版本管理資訊到POM的地方。

  1. <scm>
  2. <connection>scm:svn:http://127.0.0.1/svn/my-project</connection>
  3. <developerConnection>scm:svn:https://127.0.0.1/svn/my-project</developerConnection>
  4. <tag>HEAD</tag>
  5. <url>http://127.0.0.1/websvn/my-project</url>
  6. </scm>
  • connection:要求對原始碼有讀的許可權,可以更新;developerConnection:要求對原始碼有寫的許可權,可以提交程式碼;Maven有另一個專案Maven SCM,提供公共的API,供SCM的外掛實現。目前所有的SCM的外掛可以在http://maven.apache.org/scm/scms-overview.html上找到;
  • tag:指定該專案所在的標籤。HEAD是預設;
  • url:一個公共的可瀏覽的倉庫。

Prerequisites

為了讓該POM正確的執行所需要的先決條件,這裡是你定義先決條件的地方。如果不滿足這些先決條件,Maven將不會開始。目前只有maven的最小版本號一個先決條件。

  1. <prerequisites>
  2. <maven>2.0.6</maven>
  3. </prerequisites>

Repositories

  1. <repositories>
  2. <repository>
  3. <releases>
  4. <enabled>false</enabled>
  5. <updatePolicy>always</updatePolicy>
  6. <checksumPolicy>warn</checksumPolicy>
  7. </releases>
  8. <snapshots>
  9. <enabled>true</enabled>
  10. <updatePolicy>never</updatePolicy>
  11. <checksumPolicy>fail</checksumPolicy>
  12. </snapshots>
  13. <id>codehausSnapshots</id>
  14. <name>Codehaus Snapshots</name>
  15. <url>http://snapshots.maven.codehaus.org/maven2</url>
  16. <layout>default</layout>
  17. </repository>
  18. </repositories>
  19. <pluginRepositories>
  20. ...
  21. </pluginRepositories>
  • downloadUrl:另一個POM配置用於獲取該POM的元件的倉庫的url;
  • status:這個值不能手動配置,當該元件上傳到倉庫時,Maven將設定這個專案的狀態,它的有效值為: none:沒有特殊狀態,預設;
  • converted:倉庫的管理人員從一個對Maven 2來說更早的版本轉換到這個POM;
  • partner:這個元件有被同步到一個合作倉庫;
  • deployed:最通用的狀態,這個元件從Maven2或者Maven2部署;
  • verified:這個專案被查證了,應該被終止。

Distribution Management

管理build生成的元件和資原始檔和分發。 
基本屬性
  1. <distributionManagement>
  2. ...
  3. <downloadUrl>http://mojo.codehaus.org/my-project</downloadUrl>
  4. <status>deployed</status>
  5. </distributionManagement>
  • downloadUrl:另一個POM配置用於獲取該POM的元件的倉庫的url;
  • status:這個值不能手動配置,當該元件上傳到倉庫時,Maven將設定這個專案的狀態,它的有效值為: none:沒有特殊狀態,預設;
  • converted:倉庫的管理人員從一個對Maven 2來說更早的版本轉換到這個POM;
  • partner:這個元件有被同步到一個合作倉庫;
  • deployed:最通用的狀態,這個元件從Maven2或者Maven2部署;
  • verified:這個專案被查證了,應該被終止。

Repository

distributionManagement通過repository定義當元件部署時,專案可以從哪裡(和怎麼)獲取遠端倉庫

  1. <distributionManagement>
  2. <repository>
  3. <uniqueVersion>false</uniqueVersion>
  4. <id>corp1</id>
  5. <name>Corporate Repository</name>
  6. <url>scp://repo/maven2</url>
  7. <layout>default</layout>
  8. </repository>
  9. <snapshotRepository>
  10. <uniqueVersion>true</uniqueVersion>
  11. <id>propSnap</id>
  12. <name>Propellors Snapshots</name>
  13. <url>sftp://propellers.net/maven</url>
  14. <layout>legacy</layout>
  15. </snapshotRepository>
  16. ...
  17. </distributionManagement>
  • id:倉庫的唯一標識;
  • name:人類可讀的名稱;
  • uniqueVersiontrue/false,表示部署到該倉庫的元件是否應該獲取一個唯一產生的版本號,並用這個版本號作為地址的一部分;
  • url:指定用於傳送構建成的元件(包括POM檔案和校驗和資料)到倉庫的網路地址和傳輸協議,是Repository的核心;
  • layoutdefault/legacy,同project下的repository 元素。

Site Distribution

比起分發到倉庫,distributionManagement更多的運用是定義怎麼部署專案的站點和文件。

  1. <distributionManagement>
  2. ...
  3. <site>
  4. <id>mojo.website</id>
  5. <name>Mojo Website</name>
  6. <url>scp://beaver.codehaus.org/home/projects/mojo/public_html/</url>
  7. </site>
  8. ...
  9. </distributionManagement>

Relocation

  1. <distributionManagement>
  2. ...
  3. <relocation>
  4. <groupId>org.apache</groupId>
  5. <artifactId>my-project</artifactId>
  6. <version>1.0</version>
  7. <message>We have moved the Project under Apache</message>
  8. </relocation>
  9. ...
  10. </distributionManagement>

專案在發展的過程中,可能被迫轉移到其它更適合的地方。relocation用於給專案的使用者指名該專案被重新命名為什麼(例如上面,專案被重新命名到org.apache:my-project:1.0),除此之外,它還提供一個專案轉移的解釋。

Profiles

POM 4.0的一個新特徵是改變專案被構建的環境的settings的能力。

  1. <profiles>
  2. <profile>
  3. <id>test</id>
  4. <activation>...</activation>
  5. <build>...</build>
  6. <modules>...</modules>
  7. <repositories>...</repositories>
  8. <pluginRepositories>...</pluginRepositories>
  9. <dependencies>...</dependencies>
  10. <reporting>...</reporting>
  11. <dependencyManagement>...</dependencyManagement>
  12. <distributionManagement>...</distributionManagement>
  13. </profile>
  14. </profiles>

Activation

Activation是profile的關鍵。一個profile的威力來自於在當前的環境下修改基本POM的能力。

  1. <profiles>
  2. <profile>
  3. <id>test</id>
  4. <activation>
  5. <activeByDefault>false</activeByDefault>
  6. <jdk>1.5</jdk>
  7. <os>
  8. <name>Windows XP</name>
  9. <family>Windows</family>
  10. <arch>x86</arch>
  11. <version>5.1.2600</version>
  12. </os>
  13. <property>
  14. <name>sparrow-type</name>
  15. <value>African</value>
  16. </property>
  17. <file>
  18. <exists>${basedir}/file2.properties</exists>
  19. <missing>${basedir}/file1.properties</missing>
  20. </file>
  21. </activation>
  22. ...
  23. </profile>
  24. </profiles>
  • jdk:如果jdk版本號匹配被給的字首,則profile被啟用,例如:1.5.0_06將匹配上面的配置;
  • os:在哪些作業系統下profile被啟用;
  • property:profile將啟用,如果Maven探測到一個對應的name=value對的property
  • file:一個通過file的existence指定的檔名可以啟用profile。

相關推薦

Maven的pom.xml檔案Environment Settings

Issue Management 使用的缺陷跟蹤系統(Bugzilla,TestTrack,ClearQuest,等)資訊,主要用於產生專案文件。 <issueManagement>

Settings.xml檔案

概要    settings.xml有什麼用?    settings.xml檔案位置    配置優先順序    頂級元素概覽    LocalRepository    InteractiveMode    UsePluginRegistry    Offline    PluginGroups    

Spring MVC 配置檔案dispatcher-servlet.xml 檔案

<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:mvc="http://www.springframew

maven核心:pom.xml檔案

什麼是pom?     pom作為專案物件模型。通過xml表示maven專案,使用pom.xml來實現。主要描述了專案:包括配置檔案;開發者需要遵循的規則,缺陷管理系統,組織和licenses,專案的url,專案的依賴性,以及其他所有的專案相關因素。 快

3.pom.xml檔案(慕課網)

<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-in

Tomcat:server.xml檔案

一、server.xml檔案介紹 1.server.xml作用     Server.xml配置檔案用於對整個容器進行相關的配置。 2.server.xml檔案的配置元素列表     <Server>:是整個配置檔案的根元素。表示整個Catalina容器。   

Maven pom.xml檔案

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.a

史上最全的maven的pom.xml檔案

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://m

axis2系列之services.xml檔案

   原文連結(http://beyond-gzz.blog.163.com/blog/static/744735620119935948592/ )在Axis1中部署服務時,我們使用service.wsdd檔案來配置服務。在Axis2中,不再使用service.wsdd

SqlMapConfig.xml檔案

SqlMapConfig.xml 是 mybatis 的全域性配置檔案,配置內容如下: properties(屬性) settings(全域性配置引數) typeAliases(類型別名) typeHandlers(型別處理器) objectFactory(物件工廠) plugins(外掛) e

Maven的pom.xml檔案

快速預覽 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="

AndroidManifest.xml檔案(二)

檔案約定 某些約定和規則普遍適用於清單中的所有元素和屬性: 元素 只用<manifest>和<application>元素時必須的,而且這兩個元素在檔案中只能出現一次。其他元素則可以多次出現在清單中,或者根本就不出現---但是為了構建一個有意義的清單

MyBatis Mapper XML檔案

MyBatis 的真正強大在於它的對映語句,也是它的魔力所在。由於它的異常強大,對映器的 XML 檔案就顯得相對簡單。如果拿它跟具有相同功能的 JDBC 程式碼進行對比,你會立即發現省掉了將近 95% 的程式碼。MyBatis 就是針對 SQL 構建的,並且比普通的方法做

最全的maven的pom.xml檔案

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="h

Spring MVC 配置檔案 web.xml檔案

<?xml version="1.0" encoding="UTF-8"?> <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http

javaweb web.xml檔案

<!-- 基本配置 --> <servlet> <servlet-name>snoop</servlet-name> <servlet-class>SnoopServlet</servlet-class> </ser

AndroidManifest.xml檔案(uses-sdk)(轉載)

語法(SYNTAX): <uses-sdkandroid:minSdkVersion="integer"android:targetSdkVersion="integer"android:maxSdkVersion="integer"/> 被包含於(C

XML檔案以及解析

例子: 注:xml宣告一般是xml文件的第一行;xml宣告由以下幾個部分組成: 4、根元素 它是xml文件裡面唯一的;它的開始是放在最前面,結束是放在最後面。 5、元素: (1) 所有的xml元素都必須有結束標籤; (2) xml標籤對大小寫敏感; (3)  xml必須

web.xml檔案

轉載地址:https://www.cnblogs.com/LiZhiW/p/4313844.html 一、web.xml檔案介紹 1.web.xml檔案的作用 web.xml主要用來配置Filter、Listener、Servlet等。但是要說明的是web.xm

【SpringMVC+mybatis】7.mybatis SqlMapConfig.xml檔案

mybatis的全域性配置檔案SqlMapConfig.xml主要配置內容有:properties(屬性),settings(全域性配置引數),typeAliases(類型別名),typeHandlers(型別處理器),objectFactory(物件工廠),plugins