Maven pom.xml配置詳解(三)

環境設置html

issueManagement

<!--項目的問題管理系統(Bugzilla,Jira,Scarab,或任何你喜歡的問題管理系統)的名稱和URL,本例爲jira-->web

<issueManagement>apache

<!--問題管理系統(例如jira)的名字,-->windows

<system>jira</system>api

<!--該項目使用的問題管理系統的URL-->服務器

<url>http://jira.baidu.com/banseon</url>maven

</issueManagement>svn

ciManagement

<!--項目持續集成信息-->工具

<ciManagement>佈局

<!--持續集成系統的名字,例如continuum-->

<system>continuum</system>

<!--該項目使用的持續集成系統的URL(若是持續集成系統有web接口的話)。-->

<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/>

<!--通知擴展配置項-->

<configuration><address>continuum@127.0.0.1</address></configuration>

</notifier>

</notifiers>

</ciManagement>

mailingLists

<!--項目相關郵件列表信息-->

<mailingLists>

<!--該元素描述了項目相關的全部郵件列表。自動產生的網站引用這些信息。-->

<mailingList>

<!--郵件的名稱-->

<name>User List</name>

<!--發送郵件的地址或連接,若是是郵件地址,建立文檔時,mailto:連接會被自動建立-->

<post>user@127.0.0.1</post>

<!--訂閱郵件的地址或連接,若是是郵件地址,建立文檔時,mailto:連接會被自動建立-->

<subscribe>user-subscribe@127.0.0.1</subscribe>

<!--取消訂閱郵件的地址或連接,若是是郵件地址,建立文檔時,mailto:連接會被自動建立-->

<unsubscribe>user-unsubscribe@127.0.0.1</unsubscribe>

<!--你能夠瀏覽郵件信息的URL-->

<archive>http://127.0.0.1/user/</archive>

<!--備用url的連接,能夠瀏覽存檔列表。-->

<otherArchives>

<otherArchive>http://base.google.com/base/1/127.0.0.1</otherArchive>

</mailingList>

</mailingLists>

scm

<!--SCM(Source Control Management)標籤容許你配置你的代碼庫,供Maven web站點和其它插件使用。-->

<scm>

<!--SCM的URL,該URL描述了版本庫和如何鏈接到版本庫。欲知詳情,請看SCMs提供的URL格式支持列表。該鏈接只讀。-->

<connection>scm:svn:http://127.0.0.1/svn/my-project</connection>

<!--給開發者使用的,相似connection元素。即該鏈接不單單隻讀-->

<developerConnection>scm:svn:https://127.0.0.1/svn/my-project</developerConnection>

<!--當前代碼的標籤,在開發階段默認爲HEAD-->

<tag>HEAD</tag>

<!--指向項目的可瀏覽SCM庫(例如ViewVC或者Fisheye)的URL。-->

<url>http://127.0.0.1/websvn/my-project</url>

</scm>

prerequisites

<!--描述了這個項目構建環境中的前提條件。-->

<prerequisites>

<!--構建該項目或使用該插件所須要的Maven的最低版本。默認值:2.0-->

<maven>2.0.6</maven>

</prerequisites>

repositories

<!--遠程倉庫列表,它是Maven用來填充構建系統本地倉庫所使用的一組遠程項目。 -->

   <repositories>

    <!--包含須要鏈接到遠程倉庫的信息 -->

    <repository>

     <!--遠程倉庫惟一標識-->

     <id>codehausSnapshots</id>

     <!--遠程倉庫名稱 -->

     <name>Codehaus Snapshots</name>

     <!--如何處理遠程倉庫裏發佈版本的下載-->

     <releases>

      <!--true或者false表示該倉庫是否爲下載某種類型構件(發佈版,快照版)開啓。  -->

      <enabled>false</enabled>

      <!--該元素指定更新發生的頻率。Maven會比較本地POM和遠程POM的時間戳。這裏的選項是:always(一直),daily(默認,每日),interval:X(這裏X是以分鐘爲單位的時間間隔),或者never(從不)。 -->

      <updatePolicy>always</updatePolicy>

      <!--當Maven驗證構件校驗文件失敗時該怎麼作-ignore(忽略),fail(失敗),或者warn(警告)。-->

      <checksumPolicy>warn</checksumPolicy>

     </releases>

     <!--如何處理遠程倉庫裏快照版本的下載。有了releases和snapshots這兩組配置,POM就能夠在每一個單獨的倉庫中,爲每種類型的構件採起不一樣的策略。例如,可能有人會決定只爲開發目的開啓對快照版本下載的支持。參見repositories/repository/releases元素-->

     <snapshots>

      <enabled/><updatePolicy/><checksumPolicy/>

     </snapshots>

     <!--遠程倉庫URL,按protocol://hostname/path形式 -->

     <url>http://snapshots.maven.codehaus.org/maven2</url>

     <!--用於定位和排序構件的倉庫佈局類型-能夠是default(默認)或者legacy(遺留)。Maven 2爲其倉庫提供了一個默認的佈局;然而,Maven 1.x有一種不一樣的佈局。咱們可使用該元素指定佈局是default(默認)仍是legacy(遺留)。 -->

     <layout>default</layout>

    </repository>

   </repositories>

pluginRepositories

<!--包含須要鏈接到遠程插件倉庫的信息.參見repositories/repository元素-->

<pluginRepositories>

<pluginRepository>

<releases>

<enabled/>

<updatePolicy/>

<checksumPolicy/>

</releases>

<snapshots>

<enabled/>

<updatePolicy/>

<checksumPolicy/>

</snapshots>

<id/>

<name/>

<url/>

<layout/>

</pluginRepository>

</pluginRepositories>

distributionManagement

<!--項目分發信息,在執行mvndeploy後表示要發佈的位置。有了這些信息就能夠把網站部署到遠程服務器或者把構件部署到遠程倉庫。-->

<distributionManagement>

<!--部署項目產生的構件到遠程倉庫須要的信息,參見repositories/repository元素-->

<repository>

<!--true:分配給快照一個惟一的版本號(由時間戳和構建流水號組成)。false:每次都使用相同的版本號 -->

<uniqueVersion>true</uniqueVersion>

 <id/>

<name/>

<url/>

 <layout/>

<releases>

<enabled/>

<updatePolicy/>

<checksumPolicy/>

</releases>

<snapshots>

<enabled/>

<updatePolicy/>

<checksumPolicy/>

</snapshots>

</repository>

<!--構件的快照部署到哪裏? -->

<snapshotRepository>

<uniqueVersion>true</uniqueVersion>

 <id/>

<name/>

<url/>

 <layout/>

<releases>

<enabled/>

<updatePolicy/>

<checksumPolicy/>

</releases>

<snapshots>

<enabled/>

<updatePolicy/>

<checksumPolicy/>

</snapshots>

</snapshotRepository>

<!--部署項目的網站須要的信息-->

<site>

<!--部署位置的惟一標識符,用來匹配站點和settings.xml文件裏的配置-->

<id>banseon-site</id>

<!--部署位置的名稱-->

<name>businessapiwebsite</name>

<!--部署位置的URL,按protocol://hostname/path形式-->

<url>

scp://svn.baidu.com/banseon:/var/www/localhost/banseon-web

</url>

</site>

<!--項目下載頁面的URL。若是沒有該元素,用戶應該參考主頁。使用該元素的緣由是:幫助定位那些不在倉庫裏的構件(因爲license限制)。-->

<downloadUrl/>

<!--若是構件有了新的groupID和artifactID(構件移到了新的位置),這裏列出構件的重定位信息。-->

<relocation>

<!--構件新的groupID-->

<groupId/>

<!--構件新的artifactID-->

<artifactId/>

<!--構件新的版本號-->

<version/>

<!--顯示給用戶的,關於移動的額外信息,例如緣由。-->

<message/>

</relocation>

<!--給出該構件在遠程倉庫的狀態。不得在本地項目中設置該元素,由於這是工具自動更新的。有效的值有:none(默認),converted(倉庫管理員從Maven1 POM轉換過來),partner(直接從夥伴Maven2倉庫同步過來),deployed(從Maven2實例部署),verified(被覈實時正確的和最終的)。-->

<status/>

</distributionManagement>

profiles

<!--在列的項目構建profile,若是被激活,會修改構建處理-->

<profiles>

<!--根據環境參數或命令行參數激活某個構建處理-->

<profile>

<!--構建配置的惟一標識符。即用於命令行激活,也用於在繼承時合併具備相同標識符的profile。-->

<id>test</id>

   <!--自動觸發profile的條件邏輯。Activation是profile的開啓鑰匙。如POM中的profile同樣,profile的力量來自於它可以在某些特定的環境中自動使用某些特定的值;這些環境經過activation元素指定。activation元素並非激活profile的惟一方式。settings.xml文件中的activeProfile元素能夠包含profile的id。profile也能夠經過在命令行,使用-P標記和逗號分隔的列表來顯式的激活(如,-P test)。-->

   <activation>

    <!--profile默認是否激活的標識-->

    <activeByDefault>false</activeByDefault>

    <!--當匹配的jdk被檢測到,profile被激活。例如,1.4激活JDK1.4,1.4.0_2,而!1.4激活全部版本不是以1.4開頭的JDK。-->

    <jdk>1.5</jdk>

    <!--當匹配的操做系統屬性被檢測到,profile被激活。os元素能夠定義一些操做系統相關的屬性。-->

    <os>

     <!--激活profile的操做系統的名字 -->

     <name>Windows XP</name>

     <!--激活profile的操做系統所屬家族(如 'windows')  -->

     <family>Windows</family>

     <!--激活profile的操做系統體系結構  -->

     <arch>x86</arch>

     <!--激活profile的操做系統版本-->

     <version>5.1.2600</version>

    </os>

    <!--若是Maven檢測到某一個屬性(其值能夠在POM中經過${name}引用),其擁有對應的name = 值,Profile就會被激活。若是值字段是空的,那麼存在屬性名稱字段就會激活profile,不然按區分大小寫方式匹配屬性值字段-->

    <property>

     <!--激活profile的屬性的名稱-->

     <name>mavenVersion</name>

     <!--激活profile的屬性的值 -->

     <value>2.0.3</value>

    </property>

    <!--提供一個文件名,經過檢測該文件的存在或不存在來激活profile。missing檢查文件是否存在,若是不存在則激活profile。另外一方面,exists則會檢查文件是否存在,若是存在則激活profile。-->

    <file>

     <!--若是指定的文件存在,則激活profile。 -->

     <exists>${basedir}/file2.properties</exists>

     <!--若是指定的文件不存在,則激活profile。-->

     <missing>${basedir}/file1.properties</missing>

    </file>

   </activation>

<!--構建項目所須要的信息。參見build元素-->

<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>

<!--參見build/pluginManagement/plugins/plugin元素-->

<plugin>

<groupId/><artifactId/><version/><extensions/>

<executions>

<execution>

<id/><phase/><goals/><inherited/><configuration/>

</execution>

</executions>

<dependencies>

<!--參見dependencies/dependency元素-->

<dependency>

......

</dependency>

</dependencies>

<goals/><inherited/><configuration/>

</plugin>

</plugins>

</pluginManagement>

<plugins>

<!--參見build/pluginManagement/plugins/plugin元素-->

<plugin>

<groupId/><artifactId/><version/><extensions/>

<executions>

<execution>

<id/><phase/><goals/><inherited/><configuration/>

</execution>

</executions>

<dependencies>

<!--參見dependencies/dependency元素-->

<dependency>

......

</dependency>

</dependencies>

<goals/><inherited/><configuration/>

</plugin>

</plugins>

</build>

<!--發現依賴和擴展的遠程倉庫列表。-->

<repositories>

<!--參見repositories/repository元素-->

<repository>

<releases>

<enabled/><updatePolicy/><checksumPolicy/>

</releases>

<snapshots>

<enabled/><updatePolicy/><checksumPolicy/>

</snapshots>

<id/><name/><url/><layout/>

</repository>

</repositories>

<!--該元素描述了項目相關的全部依賴。這些依賴組成了項目構建過程當中的一個個環節。它們自動從項目定義的倉庫中下載。要獲取更多信息,請看項目依賴機制。-->

<dependencies>

<!--參見dependencies/dependency元素-->

<dependency>

......

</dependency>

</dependencies>

<!--不同意使用.如今Maven忽略該元素.-->

<reports/>

 

<!--參見distributionManagement元素-->

<distributionManagement>

......

</distributionManagement>

<!--參見properties元素-->

<properties/>

</profile>

</profiles>

</project>

<!--參考:

http://maven.apache.org/ref/3.1.0/maven-model/maven.html

https://maven.apache.org/pom.html

-->

相關文章
相關標籤/搜索