Maven pom.xml 全配置(二)不常用配置
生活随笔
收集整理的這篇文章主要介紹了
Maven pom.xml 全配置(二)不常用配置
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Maven pom.xml 全配置(二)不常用配置
這里貼出Maven pom.xml文件中使用率較少的配置參數,如果此篇文檔中沒有找到你想要的參數,移步Maven pom.xml 全配置(一)常用配置
<!-- 項目創建年份,4位數字。當產生版權信息時需要使用這個值。 --> <inceptionYear /> <!-- 描述了這個項目構建環境中的前提條件。 --> <prerequisites> <!-- 構建該項目或使用該插件所需要的Maven的最低版本 --> <maven></maven> </prerequisites> <!-- 項目的問題管理系統(Bugzilla, Jira, Scarab,或任何你喜歡的問題管理系統)的名稱和URL,本例為 jira --> <issueManagement> <!-- 問題管理系統(例如jira)的名字, --> <system> jira </system> <!-- 該項目使用的問題管理系統的URL --> <url> http://jira.baidu.com/banseon </url> </issueManagement> <!-- 項目持續集成信息 --> <ciManagement> <!-- 持續集成系統的名字,例如continuum --> <system></system> <!-- 該項目使用的持續集成系統的URL(如果持續集成系統有web接口的話)。 --> <url></url> <!-- 構建完成時,需要通知的開發者/用戶的配置項。包括被通知者信息和通知條件(錯誤,失敗,成功,警告) --> <notifiers> <!-- 配置一種方式,當構建中斷時,以該方式通知用戶/開發者 --> <notifier> <!-- 傳送通知的途徑 --> <type></type> <!-- 發生錯誤時是否通知 --> <sendOnError></sendOnError> <!-- 構建失敗時是否通知 --> <sendOnFailure></sendOnFailure> <!-- 構建成功時是否通知 --> <sendOnSuccess></sendOnSuccess> <!-- 發生警告時是否通知 --> <sendOnWarning></sendOnWarning> <!-- 不贊成使用。通知發送到哪里 --> <address></address> <!-- 擴展配置項 --> <configuration></configuration> </notifier> </notifiers> </ciManagement> <!-- 項目相關郵件列表信息 --> <mailingLists> <!-- 該元素描述了項目相關的所有郵件列表。自動產生的網站引用這些信息。 --> <mailingList> <!-- 郵件的名稱 --> <name> Demo </name> <!-- 發送郵件的地址或鏈接,如果是郵件地址,創建文檔時,mailto: 鏈接會被自動創建 --> <post> banseon@126.com </post> <!-- 訂閱郵件的地址或鏈接,如果是郵件地址,創建文檔時,mailto: 鏈接會被自動創建 --> <subscribe> banseon@126.com </subscribe> <!-- 取消訂閱郵件的地址或鏈接,如果是郵件地址,創建文檔時,mailto: 鏈接會被自動創建 --> <unsubscribe> banseon@126.com </unsubscribe> <!-- 你可以瀏覽郵件信息的URL --> <archive> http:/hi.baidu.com/banseon/demo/dev/ </archive> </mailingList> </mailingLists> <!-- 項目開發者列表 --> <developers> <!-- 某個項目開發者的信息 --> <developer> <!-- SCM里項目開發者的唯一標識符 --> <id> HELLO WORLD </id><!-- 項目開發者的全名 --> <name> banseon </name> <!-- 項目開發者的email --> <email> banseon@126.com </email> <!-- 項目開發者的主頁的URL --> <url></url> <!-- 項目開發者在項目中扮演的角色,角色元素描述了各種角色 --> <roles> <role> Project Manager </role> <role> Architect </role> </roles> <!-- 項目開發者所屬組織 --> <organization> demo </organization> <!-- 項目開發者所屬組織的URL --> <organizationUrl> http://hi.baidu.com/xxx </organizationUrl> <!-- 項目開發者屬性,如即時消息如何處理等 --> <properties> <dept> No </dept> </properties> <!-- 項目開發者所在時區, -11到12范圍內的整數。 --> <timezone> -5 </timezone> </developer> </developers> <!-- 項目的其他貢獻者列表 --> <contributors> <!-- 項目的其他貢獻者。參見developers/developer元素 --> <contributor> <!-- 項目貢獻者的全名 --> <name></name><!-- 項目貢獻者的email --><email></email><!-- 項目貢獻者的主頁的URL --><url></url><!-- 項目貢獻者所屬組織 --><organization></organization><!-- 項目貢獻者所屬組織的URL --><organizationUrl></organizationUrl><!-- 項目貢獻者在項目中扮演的角色,角色元素描述了各種角色 --> <roles> <role> Project Manager </role> <role> Architect </role> </roles><!-- 項目貢獻者所在時區, -11到12范圍內的整數。 --> <timezone></timezone><!-- 項目貢獻者屬性,如即時消息如何處理等 --> <properties> <dept> No </dept> </properties> </contributor> </contributors> <!-- 該元素描述了項目所有License列表。 應該只列出該項目的license列表,不要列出依賴項目的 license列表。如果列出多個license,用戶可以選擇它們中的一個而不是接受所有license。 --> <licenses> <!-- 描述了項目的license,用于生成項目的web站點的license頁面,其他一些報表和validation也會用到該元素。 --> <license> <!-- license用于法律上的名稱 --> <name> Apache 2 </name> <!-- 官方的license正文頁面的URL --> <url> http://www.baidu.com/banseon/LICENSE-2.0.txt </url> <!-- 項目分發的主要方式: repo,可以從Maven庫下載 manual, 用戶必須手動下載和安裝依賴 --> <distribution> repo </distribution> <!-- 關于license的補充信息 --> <comments> A business-friendly OSS license </comments> </license> </licenses> <!-- SCM(Source Control Management)標簽允許你配置你的代碼庫,供Maven web站點和其它插件使用。 --> <scm> <!-- SCM的URL,該URL描述了版本庫和如何連接到版本庫。欲知詳情,請看SCMs提供的URL格式和列表。該連接只讀。 --> <connection> scm:svn:http://svn.baidu.com/banseon/maven/banseon/banseon-maven2-trunk(dao-trunk)</connection> <!-- 給開發者使用的,類似connection元素。即該連接不僅僅只讀 --> <developerConnection> scm:svn:http://svn.baidu.com/banseon/maven/banseon/dao-trunk </developerConnection> <!-- 當前代碼的標簽,在開發階段默認為HEAD --> <tag></tag> <!-- 指向項目的可瀏覽SCM庫(例如ViewVC或者Fisheye)的URL。 --> <url> http://svn.baidu.com/banseon </url> </scm> <!-- 描述項目所屬組織的各種屬性。Maven產生的文檔用 --> <organization> <!-- 組織的全名 --> <name> demo </name> <!-- 組織主頁的URL --> <url> http://www.baidu.com/banseon </url> </organization> <!-- 該元素描述使用報表插件產生報表的規范。當用戶執行“mvn site”,這些報表就會運行。 在頁面導航欄能看到所有報表的鏈接。 --> <reporting> <!-- true,則,網站不包括默認的報表。這包括“項目信息”菜單中的報表。 --> <excludeDefaults /> <!-- 所有產生的報表存放到哪里。默認值是${project.build.directory}/site。 --> <outputDirectory /> <!-- 使用的報表插件和他們的配置。 --> <plugins> <!-- plugin元素包含描述報表插件需要的信息 --> <plugin> <!-- 報表插件在倉庫里的group ID --> <groupId></groupId> <!-- 報表插件在倉庫里的artifact ID --> <artifactId></artifactId> <!-- 被使用的報表插件的版本(或版本范圍) --> <version></version> <!-- 任何配置是否被傳播到子項目 --> <inherited>true/false</inherited> <!-- 報表插件的配置 --> <configuration></configuration> <!-- 一組報表的多重規范,每個規范可能有不同的配置。一個規范(報表集)對應一個執行目標 。例如,有1,2,3,4,5,6,7,8,9個報表。1,2,5構成A報表集,對應一個執行目標。2,5,8構成B報表集,對應另一個執行目標 --> <reportSets> <!-- 表示報表的一個集合,以及產生該集合的配置 --> <reportSet> <!-- 報表集合的唯一標識符,POM繼承時用到 --> <id></id> <!-- 產生報表集合時,被使用的報表的配置 --> <configuration></configuration> <!-- 配置是否被繼承到子POMs --> <inherited>true/false</inherited> <!-- 這個集合里使用到哪些報表 --> <reports></reports> </reportSet> </reportSets> </plugin> </plugins> </reporting> <!-- 在列的項目構建profile,如果被激活,會修改構建處理 --> <profiles> <!-- 根據環境參數或命令行參數激活某個構建處理 --> <profile> <!-- 構建配置的唯一標識符。即用于命令行激活,也用于在繼承時合并具有相同標識符的profile。 --> <id></id><!-- 自動觸發profile的條件邏輯。Activation是profile的開啟鑰匙。profile的力量來自于它能夠在某些特定的環境中自動使用某些特定的值;這些環境通過activation元素指定。activation元素并不是激活profile的唯一方式。 --> <activation> <!-- profile默認是否激活的標志 --> <activeByDefault>true/false</activeByDefault> <!-- 當匹配的jdk被檢測到,profile被激活。例如,1.4激活JDK1.4,1.4.0_2,而!1.4激活所有版本不是以1.4開頭的JDK。 --> <jdk>jdk版本,如:1.7</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中通過${名稱}引用),其擁有對應的名稱和值,Profile就會被激活。如果值字段是空的,那么存在屬性名稱字段就會激活profile,否則按區分大小寫方式匹配屬性值字段 --> <property> <!-- 激活profile的屬性的名稱 --> <name> mavenVersion </name> <!-- 激活profile的屬性的值 --> <value> 2.0.3 </value> </property> <!-- 提供一個文件名,通過檢測該文件的存在或不存在來激活profile。missing檢查文件是否存在,如果不存在則激活 profile。另一方面,exists則會檢查文件是否存在,如果存在則激活profile。 --> <file> <!-- 如果指定的文件存在,則激活profile。 --> <exists> /usr/local/hudson/hudson-home/jobs/maven-guide-zh-to-production/workspace/ </exists> <!-- 如果指定的文件不存在,則激活profile。 --> <missing> /usr/local/hudson/hudson-home/jobs/maven-guide-zh-to-production/workspace/ </missing> </file> </activation> <!-- 構建項目所需要的信息。參見build元素 --> <build> <defaultGoal /> <resources> <resource> <targetPath></targetPath><filtering></filtering><directory></directory><includes><include></include></includes><excludes><exclude></exclude></excludes></resource> </resources> <testResources> <testResource> <targetPath></targetPath><filtering></filtering><directory></directory><includes><include></include></includes><excludes><exclude></exclude></excludes> </testResource> </testResources> <directory></directory><finalName></finalName><filters></filters> <pluginManagement> <plugins> <!-- 參見build/pluginManagement/plugins/plugin元素 --> <plugin> <groupId></groupId><artifactId></artifactId><version></version><extensions>true/false</extensions> <executions> <execution> <id></id><phase></phase><goals></goals><inherited>true/false</inherited><configuration></configuration> </execution> </executions> <dependencies> <!-- 參見dependencies/dependency元素 --> <dependency> </dependency> </dependencies> <goals></goals><inherited>true/false</inherited><configuration></configuration></plugin> </plugins> </pluginManagement> <plugins> <!-- 參見build/pluginManagement/plugins/plugin元素 --> <plugin> <groupId></groupId><artifactId></artifactId><version></version><extensions>true/false</extensions> <executions> <execution> <id></id><phase></phase><goals></goals><inherited>true/false</inherited><configuration></configuration> </execution> </executions> <dependencies> <!-- 參見dependencies/dependency元素 --> <dependency> </dependency> </dependencies> <goals></goals><inherited>true/false</inherited><configuration></configuration> </plugin> </plugins> </build> <!-- 發現依賴和擴展的遠程倉庫列表。 --> <repositories> <!-- 參見repositories/repository元素 --> <repository> <releases> <enabled><enabled><updatePolicy></updatePolicy><checksumPolicy></checksumPolicy> </releases> <snapshots> <enabled><enabled><updatePolicy></updatePolicy><checksumPolicy></checksumPolicy> </snapshots> <id></id><name></name><url></url><layout></layout> </repository> </repositories> <!-- 發現插件的遠程倉庫列表,這些插件用于構建和報表 --> <pluginRepositories> <!-- 包含需要連接到遠程插件倉庫的信息.參見repositories/repository元素 --> <pluginRepository> <releases> <enabled><enabled><updatePolicy></updatePolicy><checksumPolicy></checksumPolicy> </releases> <snapshots> <enabled><enabled><updatePolicy></updatePolicy><checksumPolicy></checksumPolicy></snapshots> <id></id><name></name><url></url><layout></layout> </pluginRepository> </pluginRepositories> <!-- 該元素描述了項目相關的所有依賴。 這些依賴組成了項目構建過程中的一個個環節。它們自動從項目定義的倉庫中下載。要獲取更多信息,請看項目依賴機制。 --> <dependencies> <!-- 參見dependencies/dependency元素 --> <dependency> </dependency> </dependencies> <!-- 該元素包括使用報表插件產生報表的規范。當用戶執行“mvn site”,這些報表就會運行。 在頁面導航欄能看到所有報表的鏈接。參見reporting元素 --> <reporting></reporting> <!-- 參見dependencyManagement元素 --> <dependencyManagement> <dependencies> <!-- 參見dependencies/dependency元素 --> <dependency> </dependency> </dependencies> </dependencyManagement> <!-- 參見distributionManagement元素 --> <distributionManagement> </distributionManagement> <!-- 參見properties元素 --> <properties /> </profile> </profiles> <!-- 發現插件的遠程倉庫列表,這些插件用于構建和報表 --> <pluginRepositories> <!-- 包含需要連接到遠程插件倉庫的信息.參見repositories/repository元素 --> <pluginRepository> </pluginRepository> </pluginRepositories> <!-- 項目分發信息,在執行mvn deploy后表示要發布的位置。有了這些信息就可以把網站部署到遠程服務器或者把構件部署到遠程倉庫。 --> <distributionManagement> <!-- 部署項目產生的構件到遠程倉庫需要的信息 --> <repository> <!-- 是分配給快照一個唯一的版本號(由時間戳和構建流水號)?還是每次都使用相同的版本號?參見repositories/repository元素 --> <uniqueVersion /> <id> banseon-maven2 </id> <name> banseon maven2 </name> <url> file://${basedir}/target/deploy </url> <layout></layout> </repository> <!-- 構件的快照部署到哪里?如果沒有配置該元素,默認部署到repository元素配置的倉庫,參見distributionManagement/repository元素 --> <snapshotRepository> <uniqueVersion /> <id> banseon-maven2 </id> <name> Banseon-maven2 Snapshot Repository </name> <url> scp://svn.baidu.com/banseon:/usr/local/maven-snapshot </url> <layout></layout></snapshotRepository> <!-- 部署項目的網站需要的信息 --> <site> <!-- 部署位置的唯一標識符,用來匹配站點和settings.xml文件里的配置 --> <id> banseon-site </id> <!-- 部署位置的名稱 --> <name> business api website </name> <!-- 部署位置的URL,按protocol://hostname/path形式 --> <url> scp://svn.baidu.com/banseon:/var/www/localhost/banseon-web </url> </site> <!-- 項目下載頁面的URL。如果沒有該元素,用戶應該參考主頁。使用該元素的原因是:幫助定位那些不在倉庫里的構件(由于license限制)。 --> <downloadUrl /> <!-- 如果構件有了新的group ID和artifact ID(構件移到了新的位置),這里列出構件的重定位信息。 --> <relocation> <!-- 構件新的group ID --> <groupId></groupId> <!-- 構件新的artifact ID --> <artifactId></artifactId> <!-- 構件新的版本號 --> <version></version> <!-- 顯示給用戶的,關于移動的額外信息,例如原因。 --> <message></message> </relocation> <!-- 給出該構件在遠程倉庫的狀態。不得在本地項目中設置該元素,因為這是工具自動更新的。有效的值有:none(默認),converted(倉庫管理員從Maven 1 POM轉換過來),partner(直接從伙伴Maven 2倉庫同步過來),deployed(從Maven 2實例部署),verified(被核實時正確的和最終的)。 --> <status></status> </distributionManagement>轉載于:https://www.cnblogs.com/keeya/p/11438918.html
總結
以上是生活随笔為你收集整理的Maven pom.xml 全配置(二)不常用配置的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Maven pom.xml 全配置(一)
- 下一篇: DOM文档对象模型