<!--榪欓噷鏈変簺涓滆タ鏆傛椂涓嶈皥-->
<dependencies>...</dependencies> <!--渚嬪瓙錛?nbsp; <dependency><groupId>junit</groupId>
mvn install:install-file -Dfile=non-maven-proj.jar -DgroupId=some.group -DartifactId=non-maven-proj -Dversion=1
2.鍒涘緩鑷繁鐨凴epositories騫朵笖閮ㄧ講榪欎釜鍖咃紝浣跨敤綾諱技涓婇潰鐨?tt>deploy:deploy-file 鍛戒護(hù)3.璁劇疆scope涓簊ystem錛屽茍涓旀寚瀹氱郴緇熻礬寰?/p>
dependency閲岄潰鐨刢lassifier錛岀敤浜庡尯鍒嗕粠鍚屼竴涓猵om緙栬瘧鍑烘潵鐨勪絾鏄唴瀹逛笉鍚岀殑鍚屽悕鍖咃紝渚嬪鍚屼竴涓伐紼嬬紪璇戝嚭涓や釜artifact錛屼竴涓敮鎸乯dk1.5涓涓敮鎸乯dk1.4錛岄偅涔堝氨鍙互浣跨敤榪欎釜鏉ュ懡鍚嶄負(fù)jdk15鍜宩dk14鏉ュ尯鍒嗭紝瀹冨鏋滃嚭鐜板湪鍖呭悕涓紝閭d箞瀹冨繀欏昏窡鍦ㄧ増鏈彿鍚庛傝繕鏈変竴縐嶆儏鍐墊槸灝嗕竴涓伐紼嬬殑涓浜涙瑕乤rtifact闄勫埌涓昏artifact涓紝灝卞彲浠ヤ嬌鐢ㄨ繖涓潵鍖哄垎錛屼緥濡備竴涓伐紼嬩駭鐢焥ource錛宩avadoc錛宑lass涓夌涓滆タ錛岄偅涔堝氨鍙互浣跨敤涓嶅悓鐨刢lassifier鏉ュ垎鍒爣璇嗚繖浜涗笢瑗? --> <ciManagement> maven鎹曡幏涓浜涚粡甯擱噸鍙戠敓鐨勯厤緗紝鍦╪otifier鍏冪礌閲岄厤緗侫 notifier is the manner in which people are notified of certain build statuses. In the following example, this POM is setting a notifier of type mail (meaning email), and configuring the email address to use on the specified triggers sendOnError, sendOnFailure, and not sendOnSuccess or sendOnWarning. <!--渚嬪錛?br />
<scm> <prerequisites>...</prerequisites> 瀹冨寘鍚彲閫夌殑activation錛坧rofile鐨勮Е鍙戝櫒錛夊拰涓緋誨垪鐨刢hanges銆備緥濡倀est榪囩▼鍙兘浼?xì)鎸囧悜涓嶅悓鐨勬暟鎹簱锛堢浉瀵规渶緇堢殑deployment錛夋垨鑰呬笉鍚岀殑dependencies鎴栬呬笉鍚岀殑repositories錛屽茍涓旀槸鏍規(guī)嵁涓嶅悓鐨凧DK鏉ユ敼鍙樼殑銆傞偅涔堢粨鏋勫涓嬶細(xì) <profiles>
dependency閲岄潰鐨則ype錛岄粯璁や負(fù)jar錛岀被鍨嬶紝甯哥敤濡傦細(xì)jar錛宔jb-client錛宼est-jar錛屽彲浠ヨ緗畃lugins涓殑extensions鍊間負(fù)true鍚庡湪澧炲姞鏂扮被鍨?br />
dependency閲岄潰鐨剆cope錛屾寚瀹歝lasspath錛屽彲浠ヤ負(fù)錛歝ompile錛堥粯璁ょ殑錛宑ompile scope鍦ㄦ墍鏈塩lasspaths鍐呮湁鏁堬紝榪欎簺dependencies灝嗕細(xì)浼犳挱鍒伴」鐩腑銆俻rovided錛氭寚紺簀dk鎴栬呮煇涓鍣ㄥ彲浠ユ彁渚涗粬錛屽畠鍙湪compilation鍜宼est鐨刢lasspaths鏈夋晥錛岃屼笖涓嶄細(xì)浼犳挱鐨勩俽untime錛氭寚紺鴻繖涓猟ependency鍦ㄧ紪璇戣繃紼嬫槸涓嶅繀瑕佺殑錛屼絾鏄墽琛岄渶瑕侊紝鍦╰est鍜宺untime鐨刢lasspaths鏈夋晥錛屽湪compile鐨刢lasspaths鏃犳晥銆倀est錛氭寚紺鴻繖涓猟ependency鍦ㄤ竴鑸▼搴忚繍琛屾槸鏃犳晥鐨勶紝浣嗘槸鍦╰est鐨刢ompilation鍜宔xecution鏄湁鏁堢殑錛宻ystem鍒欒窡provided綾諱技錛屼絾鏄繖縐峝ependency蹇呴』浜哄伐鏄庣‘鍦板埗瀹氥傝繖縐嶄緷璧栦笉浼?xì)鍦╮epository涓煡鎵俱?br />
dependency閲岄潰鐨剆ystemPath錛氬彧鍦╠ependency鐨剆cope澹版槑涓簊ystem鐨勬椂鍊欐墠鏈夌敤闄わ紝鍚﹀垯錛宐uild鐨勮繃紼嬪皢浼?xì)澶辫触銆傝礬寰勫繀欏繪槸緇濆鐨勶紝鎵浠ユ渶濂戒嬌鐢╬roperty鏉ュ0鏄庢満鍣ㄧ殑鐗瑰畾璺緞銆?br />
dependency閲岄潰鐨刼ptional錛氬鏋滃伐紼嬫湰韜槸涓涓猟ependency閭d箞灝辨爣璁頒負(fù)optional錛屼緥濡俋闇瑕丄錛孉闇瑕丅錛岄偅涔圶鍙渶瑕乷ptional鐨凚錛屽垯B鍦╔涓氨鏄痮ptional澹版槑鐨勪簡(jiǎn)
dependency閲岄潰鐨別xclusions錛氬鏋淴闇瑕丄錛孉鍖呭惈B渚濊禆錛岄偅涔圶鍙互澹版槑涓嶈B渚濊禆錛屽彧瑕佸湪exclusions涓0鏄巈xclusion銆俹ptional鏄笉浼?xì)install鎴栬呬嬌鐢˙錛岃宔xclusion鏄皢B浠庝緷璧栨爲(wèi)涓槸鍒犻櫎銆備緥濡俛ppfuse涓嶆兂浣跨敤hibernate錛屼絾鏄痑ppfuse鏄泦鎴恏ibernate鐨勶紝鎵浠ュ氨鎺掗櫎鎺夛細(xì)
<exclusions>
<exclusion>
<groupId>org.appfuse</groupId>
<artifactId>appfuse-hibernate</artifactId>
</exclusion>
</exclusions>-->
<!--Inheritance錛氬鏋滀竴涓伐紼嬫槸pareent鎴栬卆ggregation錛堝嵆mutil-module鐨勶級(jí)鐨勶紝閭d箞蹇呴』鍦╬ackaging璧嬪紁om銆俢hild宸ョ▼浠巔arent緇ф壙鐨勫寘鎷細(xì)dependencies錛宒evelopers and contributors錛宲lugin lists錛宺eports lists錛宲lugin execution with matching ids錛宲lugin configuration-->
<parent>...</parent> <!--鍙傜収涓嬮潰渚嬪瓙錛歳elativePath鏄彲閫夌殑錛宮aven浼?xì)棣栧厛鎼滅储杩欎釜鍦板潃錛屽湪鎼滅儲(chǔ)鏈湴鍜岃繙紼媟epositories涔嬪墠
<parent>
<groupId>org.codehaus.mojo</groupId>
<artifactId>my-parent</artifactId>
<version>2.0</version>
<relativePath>../my-parent</relativePath>
</parent>
-->
<dependencyManagement>...</dependencyManagement> <!--鐢ㄤ簬甯姪綆$悊children鐨刣ependencies銆備緥濡傚鏋減arent浣跨敤dependencyManagement瀹氫箟涓涓猟ependencyon junit:junit:4.0錛岄偅涔堝畠鐨刢hildren灝卞彲浠ュ彧寮曠敤groupId鍜宎rtifactId錛岃寁ersion灝卞彲浠ラ氳繃parent鏉ヨ緗傚ソ澶勫氨鏄泦涓鐞嗕緷璧栬鎯?->
<modules>...</modules><!--瀵逛簬澶氭ā鍧梡roject錛宱uter-module娌℃湁蹇呰鑰冭檻inner-module鐨刣ependencies錛屽綋鍒楀嚭modules鐨勬椂鍊欍俶odules鐨勯『搴忔槸涓嶉噸瑕佺殑錛屽洜涓簃aven浼?xì)鑷姩鏍规嵁渚濊禆鍏尘p繪潵鎷撴墤鎺掑簭錛宮odules渚嬪瓙錛?br />
<module>my-project<module>
<module>another-project<module>
-->
<properties>...</properties> <!--鍙傜収http://www.tkk7.com/jianyue/articles/maven2_setting.html錛屾槸涓鏍風(fēng)殑-->
<!-- Build Settings --><build>...</build> <!--
defaultGoal錛?/strong>榛樿鐨勭洰鏍囷紝蹇呴』璺熷懡浠よ涓婄殑鍙傛暟鐩稿悓渚嬪jar:jar錛屾垨鑰呬笌鏃舵湡錛坧arse錛夌浉鍚岋紝渚嬪install
directory錛?/strong>鎸囧畾build target鐩爣鐨勭洰褰曪紝榛樿涓?{basedir}/target錛屽嵆欏圭洰鏍圭洰褰曚笅鐨則arget
finalName錛?/strong>鎸囧畾鍘繪帀鍚庣紑鍚嶅悗鐨勫伐紼嬪悕瀛楋紝渚嬪錛氶粯璁や負(fù)${artifactId}-${version}
filters錛?/strong>鐢ㄤ簬瀹氫箟鎸囧畾filter灞炴ф枃浠朵綅緗紝渚嬪filter鍏冪礌璧嬪糵ilters/filter1.properties錛岄偅涔堣繖涓枃浠墮噷闈㈠氨鍙互瀹氫箟name=value瀵癸紝榪欎釜name=value瀵圭殑鍊煎氨鍙互鍦ㄥ伐紼媝om涓氳繃${name}寮曠敤錛岄粯璁ょ殑filter鐩綍鏄?tt>${basedir}/src/main/filters/
resources錛?/strong>鎻忚堪宸ョ▼涓祫婧愮殑浣嶇疆
<resource>
<targetPath>META-INF/plexus</targetPath>
<filtering>false</filtering>
<directory>${basedir}/src/main/plexus</directory>
<includes>
<include>configuration.xml</include>
</includes>
<excludes>
<exclude>**/*.properties</exclude>
</excludes>
</resource>
targetPath錛氭寚瀹歜uild璧勬簮鍒板摢涓洰鐨勭洰褰曪紝榛樿鏄痓ase directory
filtering錛氭寚瀹氭槸鍚﹀皢filter鏂囦歡錛堝嵆涓婇潰璇寸殑filters閲屽畾涔夌殑*.property鏂囦歡錛夌殑鍙橀噺鍊煎湪榪欎釜resource鏂囦歡鏈夋晥錛屼緥濡備笂闈㈠氨鎸囧畾閭d簺鍙橀噺鍊煎湪configuration鏂囦歡鏃犳晥
directory錛氭寚瀹氬睘鎬ф枃浠剁殑鐩綍錛宐uild鐨勮繃紼嬮渶瑕佹壘鍒板畠錛屽茍涓斿皢鍏舵斁鍒皌argetPath涓嬨傞粯璁ょ殑directory鏄?tt>${basedir}/src/main/resources
includes錛氭寚瀹氬寘鍚枃浠剁殑patterns錛岀鍚堟牱寮忓茍涓斿湪directory鐩綍涓嬬殑鏂囦歡灝嗕細(xì)鏄寘鍚繘project鐨勮祫婧愭枃浠?br />
excludes錛氭寚瀹氫笉鍖呭惈鍦ㄥ唴鐨刾atterns錛屽鏋渋ncludes涓巈xcludes鏈夊啿紿侊紝閭d箞excludes鑳滃埄錛岄偅浜涚鍚堝啿紿佹牱寮忕殑鏂囦歡榪樻槸涓嶄細(xì)鍖呭惈榪涙潵鐨?br />
testResources錛?/strong>榪欎釜妯″潡鍖呭惈嫻嬭瘯璧勬簮鍏冪礌錛屽叾鍐呭瀹氫箟涓巖esources綾諱技銆備笉鍚岀殑涓鐐規(guī)槸榛樿鐨勬祴璇曡祫婧愯礬寰勬槸${basefir}/src/test/resources錛屾祴璇曡祫婧愭槸涓嶉儴緗茬殑銆?br />
-->
<plugins>...</plugins> <!--
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.0</version>
<extensions>false</extensions>
<inherited>true</inherited>
<configuration>
<classifier>test</classifier>
</configuration>
<dependencies>...</dependencies>
<executions>...</executions>
</plugin>
extensions錛歵rue or false錛屽喅瀹氭槸鍚﹁load榪欎釜plugin鐨別xtensions
inherited錛氭槸鍚﹁瀛恜om緇ф壙true or false
configuration錛氶氬父鐢ㄤ簬縐佹湁涓嶅紑婧愮殑plugin錛屼笉鑳藉璇︾粏浜?jiǎn)瑙lugin鐨勫唴閮ㄥ伐浣滃師鐞嗭紝浣嗕嬌plugin婊¤凍闇瑕佹弧瓚崇殑properties
dependencies錛氫笌pom鍩虹鐨刣ependencies鐨勭粨鏋勫拰鍔熻兘閮界浉鍚岋紝鍙槸plugin鐨刣ependencies鐢ㄤ簬plugin錛岃宲om鐨刣ependencies鐢ㄤ簬鏈韓榪欎釜宸ョ▼錛屽湪plugin鐨刣ependencies涓昏鐢ㄤ簬鏀瑰彉plugin鍘熸潵鐨刣ependencies錛屼緥濡傛帓闄や竴浜涚敤涓嶅埌鐨刣ependency鎴栬呬慨鏀筪ependency鐨勭増鏈瓑錛岃緇嗚鐪媝om鍩虹鐨刣ependencies
executions錛歱lugin涔熸湁寰堝涓洰鏍囷紝姣忎釜鐩爣鍏鋒湁涓嶅悓鐨勯厤緗紝executions灝辨槸璁懼畾plugin鐨勭洰鏍?br />
<execution>
<id>echodir</id>
<goals>
<goal>run</goal>
</goals>
<phase>verify</phase>
<inherited>false</inherited>
<configuration>
<tasks>
<echo>Build Dir: ${project.build.directory}</echo>
</tasks>
</configuration>
</execution>
id錛氭爣璇嗙
goals錛氶噷闈㈠垪鍑轟竴緋誨垪鐨刧oal鍏冪礌錛屼緥濡備笂闈㈢殑run goal
phase錛氬0鏄巊oals鎵ц鐨勬椂鏈燂紝渚嬪錛歷erify
inherited錛氭槸鍚︿紶閫抏xecution鍒板瓙pom
configuration錛氳緗甧xecution涓嬪垪琛ㄧ殑goals 鐨勮緗紝鑰屼笉鏄痯lugin鎵鏈塯oals鐨勮緗?br />
plugin Management: 鐢ㄤ簬綆$悊plugin錛屼笌pom build閲岀殑plugins鍖哄埆鏄紝榪欓噷鐨刾lugin鏄垪鍑烘潵錛岀劧鍚庤瀛恜om鏉ュ喅瀹氭槸鍚﹀紩鐢ㄧ殑錛屼緥濡傚悗闈㈢殑寮曠敤鏂規(guī)硶銆?br />
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>pre-process-classes</id>
<phase>compile</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classifier>pre-process</classifier>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
瀛恜om寮曠敤鏂規(guī)硶錛?br />
鍦╬om鐨刡uild閲岀殑plugins寮曠敤錛?br />
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
</plugin>
</plugins>
build 閲岄潰鐨?/strong>Directories錛?/strong>
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
<scriptSourceDirectory>${basedir}/src/main/scripts</scriptSourceDirectory>
<testSourceDirectory>${basedir}/src/test/java</testSourceDirectory>
<outputDirectory>${basedir}/target/classes</outputDirectory>
<testOutputDirectory>${basedir}/target/test-classes</testOutputDirectory>
榪欏嚑涓厓绱犲彧鍦╬arent bulid element閲岄潰瀹氫箟錛屼粬浠緗縐嶈礬寰勭粨鏋勶紝浠栦滑騫朵笉鍦╬rofile閲岋紝鎵浠ヤ笉鑳介氳繃profile鏉ヤ慨鏀?br />
build 閲岄潰鐨?/strong>Extensions錛?br />
瀹冧滑鏄竴緋誨垪build榪囩▼涓浣跨敤鐨勪駭鍝侊紝浠栦滑浼?xì)鍖呭惈鍦╮unning bulid‘s classpath閲岄潰銆備粬浠彲浠ュ紑鍚痚xtensions錛屼篃鍙互閫氳繃鎻愪緵鏉′歡鏉ユ縺媧籶lugins銆傜畝鍗曟潵璁詫紝extensions鏄湪build榪囩▼琚縺媧葷殑浜у搧
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ftp</artifactId>
<version>1.0-alpha-3</version>
</extension>
</extensions>
-->
<reporting>...</reporting> <!--
reporting鍖呭惈site鐢熸垚闃舵鐨勪竴浜涘厓绱狅紝鏌愪簺maven plugin鍙互鐢熸垚reports騫朵笖鍦╮epoting涓嬮厤緗備緥濡俲avadoc錛宮aven site絳夛紝鍦╮eporting涓嬮厤緗畆eprot plugin鐨勬柟娉曚笌build鍑犱箮涓鏍鳳紝鏈涓嶅悓鐨勬槸錛歜uild鐨刾lug-in goals鍦╡xecutions涓嬭緗紝鑰宺eporting鐨刢onfigures goals鍦╮eportset銆傛洿寰鐨勪笉鍚屾槸reporting涓嬬殑plugin configuration works as a build plugin configuration錛屼絾鏄浉鍙嶆槸涓嶅鐨勶紙鍗砨uild plugin configuration does not affect a reporting plugin錛夈?br />
excludeDefaults錛?/strong>鏄惁鎺掗櫎site generator榛樿浜х敓鐨剅eports
outpoutDirectory錛岄粯璁ょ殑dir鍙樻垚錛?tt>${basedir}/target/site
Report sets錛?/strong>璁劇疆execution goals錛岀浉褰撲簬build閲岄潰鐨別xecutions銆備笉鍚岀殑鏄笉鑳藉bind a report to another phase錛屽彧鑳藉鏄痵ite
<reporting>
<plugins>
<plugin>
...
<reportSets>
<reportSet>
<id>sunlink</id>
<reports>
<report>javadoc</report>
</reports>
<inherited>true</inherited>
<configuration>
<links>
<link>http://java.sun.com/j2se/1.5.0/docs/api/</link>
</links>
</configuration>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
reporting閲岄潰鐨勫巹reportSets鍜宐uild閲岄潰鐨別xecutions鐨勪綔鐢ㄩ兘鏄帶鍒秔om鐨勪笉鍚岀矑搴﹀幓鎺у埗build鐨勮繃紼嬶紝鎴戜滑涓嶅崟瑕侀厤緗畃lugins錛岃繕瑕侀厤緗偅浜沺lugins鍗曠嫭鐨刧oals銆?br />
-->
<!-- More Project Information -->
<description>...</description>
project鐨勬弿榪?br />
<inceptionYear>...</inceptionYear>
宸ョ▼鐨勫垵濮嬫椂闂?br />
<licenses>...</licenses>
<licenses>
<license>
<name>Apache 2</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
<comments>A business-friendly OSS license</comments>
</license>
</licenses>
<!--鍒楀嚭鏈伐紼嬬洿鎺ョ殑licenses錛岃屼笉瑕佸垪鍑篸ependencies鐨刲icenses錛?/p>
<organization>...</organization>
<!--
<organization>
<name>Codehaus Mojo</name>
<url>http://mojo.codehaus.org</url>
</organization>
寰堝宸ョ▼閮藉彈鍒版煇浜涚粍緇囪繍琛岋紝榪欓噷璁劇疆鍩烘湰淇℃伅
-->
<developers>...</developers>
<!--渚嬪錛氫竴涓紑鍙戣呭彲浠ユ湁澶氫釜roles錛宲roperties鏄?br />
<developers>
<developer>
<id>eric</id>
<name>Eric</name>
<email>eredmond@codehaus.org</email>
<url>http://eric.propellors.net</url>
<organization>Codehaus</organization>
<organizationUrl>http://mojo.codehaus.org</organizationUrl>
<roles>
<role>architect</role>
<role>developer</role>
</roles>
<timezone>-6</timezone>
<properties>
<picUrl>http://tinyurl.com/prv4t</picUrl>
</properties>
</developer>
</developers>
-->
<contributors>...</contributors>
<!--璺焏eveloper宸笉澶氾紝鍙槸contributors鏄壇鐨勫伐浣滀漢鍛橈紝涓嶈繃鑹ソ宸ョ▼搴旇闇瑕佹洿澶氱殑contributors鑰屼笉鏄痙eveloper錛屼緥濡傦細(xì)
<contributors>
<contributor>
<name>Noelle</name>
<email>some.name@gmail.com</email>
<url>http://noellemarie.com</url>
<organization>Noelle Marie</organization>
<organizationUrl>http://noellemarie.com</organizationUrl>
<roles>
<role>tester</role>
</roles>
<timezone>-5</timezone>
<properties>
<gtalk>some.name@gmail.com</gtalk>
</properties>
</contributor>
</contributors>
-->
<!-- Environment Settings --> <issueManagement>...</issueManagement>
<!--瀹氫箟defect tracking system緙洪櫡璺熻釜緋葷粺錛屾瘮濡傛湁錛坆ugzilla,testtrack,clearquest絳夛級(jí)錛屼緥濡傦細(xì)
<issueManagement>
<system>Bugzilla</system>
<url>http://127.0.0.1/bugzilla/</url>
</issueManagement>
-->
<ciManagement>...</ciManagement>
<!--Continuous Integration Management錛氳緗嚜鍔╞uild緋葷粺錛屼竴浜涢泦鎴愮▼搴忓寘鎷琧ontinuum,Cruise control絳夈備緥濡傦細(xì)
<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>continuum@127.0.0.1</address></configuration>
</notifier>
</notifiers>
</ciManagement>
-->
<mailingLists>...</mailingLists>
<!--渚嬪錛?br />
<mailingLists>
<mailingList>
<name>User List</name>
<subscribe>user-subscribe@127.0.0.1</subscribe>
<unsubscribe>user-unsubscribe@127.0.0.1</unsubscribe>
<post>user@127.0.0.1</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>
鐪嬩笉鎳傝В閲婂晩錛岀収鎼惂錛?/p>
-->
<scm>...</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>
connection, developerConnection: 閮芥槸榪炴帴瀛楃涓詫紝鍏朵腑鍚庤呮槸鍏鋒湁write鏉冮檺鐨剆cm榪炴帴錛屽父鐢ㄧ殑scm宸ュ叿鍖呮嫭cvs涓巗ubversion錛岃繕鏈夊叾浠?a >scms錛寀rl鐨勫瓧絎︿覆鏍煎紡鏄細(xì)scm:[provider]:[provider_specific]錛屼緥濡俢vs鐨勬槸scm:cvs:pserver:127.0.0.1:/cvs/root:my-project
tag錛氳鏄巔roject鎵鍦ㄧ殑鐩綍tag錛岄粯璁ゆ槸HEAD錛岃〃紺烘牴鐩綍
url錛氬叕寮鐨勫彲嫻忚repository
-->
<!--棣栬鏉′歡錛屽鏋滀笉婊¤凍錛宮aven浼?xì)鍦ㄤ簨錃g寮濮嬩箣鍓嶅け璐ワ紝鍦╬om4.0錛屽敮涓鐨勯瑕佹潯浠舵槸maven鍏冪礌-->
<repositories>...</repositories>
<!--瑕佹垚涓簃aven2鐨剅epository artifact錛屽繀欏誨叿鏈塸om鏂囦歡鍦?tt>$BASE_REPO/groupId/artifactId/version/artifactId-version.pom
BASE_REPO鍙互鏄湰鍦幫紝涔熷彲浠ユ槸榪滅▼鐨勩俽epository鍏冪礌灝辨槸澹版槑閭d簺鍘繪煡鎵劇殑repositories
榛樿鐨刢entral Maven repository鍦?a class="externalLink" >http://repo1.maven.org/maven2/錛?br />
<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>
release鍜宻napshots錛氭槸artifact鐨勪袱縐峱olicies錛宲om鍙互閫夋嫨閭g鏀跨瓥鏈夋晥銆?br />
enable錛氭湰鍒寚瀹氫袱縐嶇被鍨嬫槸鍚﹀彲鐢紝true or false
updatePolicy:璇存槑鏇存柊鍙戠敓鐨勯鐜嘺lways 鎴栬?never 鎴栬?daily錛堥粯璁ょ殑錛夋垨鑰?interval:X錛圶鏄垎閽熸暟錛?br />
checksumPolicy錛歐hen Maven deploys files to the repository, it also deploys corresponding checksum files. Your options are to ignore, fail, or warn on missing or incorrect checksums.
layout錛?/strong>maven1.x涓巑aven2鏈変笉鍚岀殑layout錛屾墍浠ュ彲浠ュ0鏄庝負(fù)default鎴栬呮槸legacy錛堥仐鐣欐柟寮弇aven1.x錛夈?br />
-->
<pluginRepositories>...</pluginRepositories>
<!--涓嶳epositories鍏鋒湁綾諱技鐨勭粨鏋勶紝鍙槸Repositories鏄痙ependencies鐨刪ome錛岃岃繖涓槸plugins 鐨刪ome銆?->
<distributionManagement>...</distributionManagement>
<!--綆$悊distribution鍜宻upporting files銆?br />
downloadUrl錛氭槸鍏朵粬欏圭洰涓轟簡(jiǎn)鎶撳彇鏈」鐩殑pom’s artifact鑰屾寚瀹氱殑url錛屽氨鏄鍛婅瘔pom upload鐨勫湴鍧涔熷氨鏄埆浜哄彲浠ヤ笅杞界殑鍦板潃銆?br />
status錛氳繖閲岀殑鐘舵佷笉瑕佸彈鍒版垜浠殑璁劇疆錛宮aven浼?xì)鑷姩璁揪|畃roject鐨勭姸鎬侊紝鏈夋晥鐨勫鹼細(xì)none錛氭病鏈夊0鏄庣姸鎬侊紝pom榛樿鐨勶紱converted錛氭湰project鏄鐞嗗憳?shù)粠鍘熷厛鐨刴aven鐗堟湰convert鍒癿aven2鐨勶紱partner錛氫互鍓嶅彨鍋歴ynched錛屾剰鎬濇槸涓巔artner repository宸茬粡榪涜浜?jiǎn)鍚屾锛沝eployed錛氳嚦浠婁負(fù)姝㈡渶緇忓父鐨勭姸鎬侊紝鎰忔濇槸鍒跺搧鏄粠maven2 instance閮ㄧ講鐨勶紝浜哄伐鍦ㄥ懡浠よdeploy鐨勫氨浼?xì)寰楀埌杩欎釜锛泇erified錛氭湰鍒跺搧宸茬粡緇忚繃楠岃瘉錛屼篃灝辨槸宸茬粡瀹氫笅鏉ヤ簡(jiǎn)鏈緇堢増銆?br />
repository錛氬0鏄巇eploy榪囩▼涓璫urrent project浼?xì)濡備綍鍙樻垚repository錛岃鏄庨儴緗插埌repository鐨勪俊鎭?br />
<repository>
<uniqueVersion>false</uniqueVersion>
<id>corp1</id>
<name>Corporate Repository</name>
<url>scp://repo1/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>
id, name:錛氬敮涓鎬х殑id錛屽拰鍙鎬х殑name
uniqueVersion錛氭寚瀹氭槸鍚︿駭鐢熶竴涓敮涓鎬х殑version number榪樻槸浣跨敤address閲岀殑鍏朵腑version閮ㄥ垎銆倀rue or false
url錛氳鏄巐ocation鍜宼ransport protocol
layout錛歞efault鎴栬卨egacy-->
<site><!---澹版槑濡備綍閮ㄧ講project‘s 鐨剆ite鍜宒ocument->
<!--渚嬪錛?br />
<site>
<id>mojo.website</id>
<name>Mojo Website</name>
<url>scp://beaver.codehaus.org/home/projects/mojo/public_html/</url>
</site>
涓庝笂闈epository鐨勫厓绱犵浉鍚屾剰鎬?br />
-->
Relocation錛?br />
<!-- 璇存槑宸ョ▼鐨勫彉鏇達(dá)紝鍦ㄨ繖閲岃鍛婁嬌鐢ㄨ呭綋蹇?jī)宸ソE嬭閲嶅懡鍚嶄簡(jiǎn)絳変俊鎭傞噸鏂版寚瀹歩d鍜屽悕縐幫紝騫朵笖鍐欎釜message娉ㄦ槑澶囨敞 <relocation>
<groupId>org.apache</groupId>
<artifactId>my-project</artifactId>
<version>1.0</version>
<message>We have moved the Project under Apache</message>
</relocation>
-->
<profiles>...</profiles>
<!--pom4.0鐨勪竴涓柊鐗規(guī)у氨鏄叿鏈夋牴鎹甧nvironment鏉ヤ慨鏀硅緗殑鑳藉姏銆?/p>
<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錛?br />
瑙﹀彂榪欎釜profile鐨勬潯浠墮厤緗涓嬩緥錛氾紙鍙渶瑕佸叾涓竴涓垚绔嬪氨鍙互嬋媧籶rofile錛屽鏋滅涓涓潯浠舵弧瓚充簡(jiǎn)錛岄偅涔堝悗闈㈠氨涓嶄細(xì)鍦ㄨ繘琛屽尮閰嶃?br />
<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>mavenVersion</name>
<value>2.0.3</value>
</property>
<file>
<exists>${basedir}/file2.properties</exists>
<missing>${basedir}/file1.properties</missing>
</file>
</activation>
-->
嬋媧籶rofile鐨勬柟娉曟湁澶氫釜錛歴etting鏂囦歡鐨刟ctiveProfile鍏冪礌鏄庣‘鎸囧畾嬋媧葷殑profile鐨処D錛屽湪鍛戒護(hù)琛屼笂鏄庣‘嬋媧籔rofile鐢?P flag 鍙傛暟
鏌ョ湅鏌愪釜build浼?xì)婵媧葷殑profile鍒楄〃鍙互鐢細(xì)mvn help:active-profiles
</project>
]]>
<settings 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/xsd/settings-1.0.0.xsd"> <localRepository/> <interactiveMode/> <usePluginRegistry/> <offline/> <pluginGroups/> <servers/> <mirrors/> <proxies/> <profiles/> <activeProfiles/> </settings>
<server>
<id>server001</id>
<username>my_login</username>
<password>my_password</password>
<privateKey>${user.home}/.ssh/id_dsa</privateKey>
<passphrase>some_passphrase</passphrase>
<filePermissions>664</filePermissions>
<directoryPermissions>775</directoryPermissions>
<configuration></configuration>
</server>
榪欎簺鏄湪榪欓噷瀹氫箟鐨勩?br />
id錛氫笌distributionManagement涓殑repository涓殑鍏冪礌id瀵瑰簲錛岀敤浜庤〃紺轟竴涓猻erver
username,password錛氬鏋渟erver闇瑕侀獙璇佺殑璇濓紝榪欎竴瀵瑰厓绱犲氨鏄敤浜庨獙璇佺殑
privateKey, passphrase錛氫篃鏄敤浜庢湇鍔″櫒楠岃瘉鐨勶紝鍓嶈呮寚瀹氱閽rivateKey錛堥粯璁?tt>${user.home}/.ssh/id_dsa錛夛紝鍚庤呮寚瀹氬彛鍙穚assphrase
filePermissions, directoryPermissions錛氫嬌鐢╨inux涓殑涓変綅鏁板瓧褰㈠紡鏍囩ず鏂囦歡涓庤礬寰勭殑鏉冮檺錛屼緥濡?64錛?75絳夈?br />
娉ㄦ剰錛氬鏋滀嬌鐢ㄧ閽ョ櫥褰曟湇鍔″櫒鐨勮瘽錛岄偅涔坧assword灝辯渷鐣ワ紝鍚﹀垯錛岀閽ヤ細(xì)琚拷鐣ャ?br />
configuration錛氬畼緗戜篃娌℃湁瑙i噴銆?/p>
<mirror>
<id>planetmirror.com</id>
<name>PlanetMirror Australia</name>
<url>http://downloads.planetmirror.com/pub/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>
id錛宯ame錛歴erver闀滃儚鐨勫敮涓鏍囪瘑涓庡彲璇繪у己鐨勫悕縐幫紙id鎵嶆槸鍞竴鐨勶級(jí)
In 2.0.9+, an enhanced syntax is supported:
The order is not important from left to right as the wildcards defer to further processing and explicit includes or excludes stop the processing. Additionally, the mirror list will now be ordered using a LinkedHashMap instead of HashMap such that the user may influence match order by changing the order of the definitions in the settings.xml
Examples:
<proxy>
<id>myproxy</id>
<active>true</active>
<protocol>http</protocol>
<host>proxy.somewhere.com</host>
<port>8080</port>
<username>proxyuser</username>
<password>somepassword</password>
<nonProxyHosts>*.google.com|ibiblio.org</nonProxyHosts>
</proxy>
id錛氳〃紺轟笉鍚岀殑proxy
active錛氬綋鏈夊涓猵roxy鐨勬椂鍊欙紝鍙湁active涓簍rue鐨勬椂鍊欐墠鏄湁鏁堢殑
protocol錛宧ost錛宲ort錛氬崗璁紝涓繪満錛岀鍙?br />
username錛宲assword錛氬鏋滈渶瑕佺殑璇濆氨鍔犱笂
nonProxyHosts錛氭帓闄や笉鐢ㄤ唬鐞嗙殑绔欑偣錛屼嬌鐢?#8220;|”鎴栬?#8220;錛?#8221;絎﹀彿鍒嗗紑涓嶅悓绔欑偣錛屽彲浠ヤ嬌鐢ㄩ氶厤絎?#8220;*”
activation, repositories, pluginRepositories and properties elements
activation鎸囧畾嬋媧昏繖涓猵rofile鐨勬潯浠躲傚叾浠栨縺媧葷殑鏂規(guī)硶錛氾紙1錛塻etting.xml鍙互閫氳繃activeProfile鍏冪礌鎸囧畾profile鐨刬d錛屾潵鏄庣‘鍦版縺媧昏繖涓猵rofile銆傦紙2錛夊湪鍛戒護(hù)琛屼笂鍔犱笂-P profile鐨刬d錛屼篃鍙互嬋媧昏繖涓猵rofile錛屽叾涓彲浠ラ氳繃“,”鍒嗗紑鍑犱釜profile鐨刬d鏉ユ寚瀹氬涓?br />
repositories鍖呭惈鐨剅epository鎸囧畾渚濊禆錛屽畠涔嬪墠鐨刟ctivation濡傛灉絎﹀悎嬋媧繪潯浠剁殑璇濆氨寮鍚繖涓緷璧?br />
pluginRepositories鍜宲roperties涔熶竴鏍鳳紝濡傛灉activation絎﹀悎嬋媧繪潯浠訛紝鍒欏畠浠皢琚縺媧?br />
渚嬪瓙1錛氬鏋滀嬌鐢╦dk-1.4鐨勮瘽錛宩dk鐨勪緷璧栧皢浼?xì)琚珛葊媧?br />
<profile>
<id>jdk-1.4</id>
<activation>
<jdk>1.4</jdk>
</activation>
<repositories>
<repository>
<id>jdk14</id>
<name>Repository for JDK 1.4 builds</name>
<url>http://www.myhost.com/maven/jdk14</url>
<layout>default</layout>
<snapshotPolicy>always</snapshotPolicy>
</repository>
</repositories>
</profile>
渚嬪瓙2錛氬鏋渢arget-env鐨勫睘鎬у間負(fù)dev鐨勬椂鍊欙紝灝辨縺媧籺omcatPath鐨勫睘鎬э紝鍏朵粬鍦版柟鑲畾浼?xì)鏈夊厓绱犲紩鐢q欎釜灞炴э紝渚嬪鍚庨潰寮曠敤
<profile>
<id>env-dev</id>
<activation>
<property>
<name>target-env</name>
<value>dev</value>
</property>
</activation>
<properties>
<tomcatPath>/path/to/tomcat/instance</tomcatPath>
</properties>
</profile>
-->
</profiles>
寮曠敤tomcatPath
| <plugin>
| <groupId>org.myco.myplugins</groupId>
| <artifactId>myplugin</artifactId>
|
| <configuration>
| <tomcatLocation>${tomcatPath}</tomcatLocation>
| </configuration>
| </plugin>
灞炴х殑寮曠敤鍙互閫氳繃${}錛屽叾涓細(xì)
1錛塭nv.***鏄紩鐢ㄥ懡浠よcomandline鍙傛暟鏃㈢幆澧冨彉閲忕瓑鍙傛暟鐨勫鹼紝渚嬪%{env.PATH}寮曠敤鐜鍙橀噺path鐨勫?br />
2錛塸roject.***寮曠敤pom鏂囦歡涓璸roject鐨勫厓绱犲鹼紝渚嬪pom涓湁涓?tt><project><version>1.0</version></project>錛岄偅涔堝彲浠?{project.version}
3錛塻etting.***寮曠敤setting鏂囦歡涓殑鍏冪礌鍊鹼紝渚嬪錛?tt><settings><offline>false</offline></settings> is accessible via ${settings.offline}
4錛塲ava.***,java System Properties錛氬湪java璇█涓彲浠ラ氳繃java.lang.System.getProperties() 鑾峰緱鐨勫奸兘鍙互閫氳繃姝ゆ潵鑾峰緱錛屼緥濡傦細(xì)${java.home}
5)***鏄湪<properties/>涓畾涔変簡(jiǎn)鐨勫彲浠ョ洿鎺ュ紩鐢ㄧ殑灞炴э紝鏂規(guī)硶%{someVar}銆?/font>
<repositories>
<repository>
<id>codehausSnapshots</id>
<name>Codehaus Snapshots</name>
<releases>
<enabled>false</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</snapshots>
<url>http://snapshots.maven.codehaus.org/maven2</url>
<layout>default</layout>
</repository>
</repositories>
1)releases, snapshots:錛堢悊瑙d笉浜?jiǎn)锛屽師鏂囩収鎼Q塗hese are the policies for each type of artifact, Release or snapshot. With these two sets, a POM has the power to alter the policies for each type independent of the other within a single repository. For example, one may decide to enable only snapshot downloads, possibly for development purposes.
2錛?strong>enabled錛歵rue鎴栬協(xié)alse鏉ユ寚鏄庤繖涓猺epository鍝釜綾誨瀷琚紑鍚?br />
3錛?strong>updatePolicy錛氬崌綰х瓥鐣ャ俆he choices are: always, daily (default), interval:X (where X is an integer in minutes) or never
4錛?strong>checksumPolicy錛歐hen Maven deploys files to the repository, it also deploys corresponding checksum files. options are to ignore, fail, or warn on missing or incorrect checksums
5錛?strong>layout錛欼n the above description of repositories, it was mentioned that they all follow a common layout. This is mostly correct. Maven 2 has a default layout for its repositories; however, Maven 1.x had a different layout. Use this element to specify which if it is default or legacy.
緇撴瀯濡傚悓Repositories錛屼絾鏄彲浠ヨ繖鏍風(fēng)悊瑙o紝repositories鐢ㄤ簬宸ョ▼榪愯涔嬪墠鐨勶紝plugin Repositories鐢ㄤ簬榪愯銆備緥濡倀omcat jetty絳夐兘鏄痯lugins錛岃宩dk錛宩ar絳夎繍琛屼箣鍓嶇殑宸ョ▼緙栬瘧鏃跺欏氨宸茬粡鐢ㄥ埌浜?/font>