<project 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/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.jeedev.myproj</groupId>
<artifactId>myproj</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<name>myproj</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
|
mvn clean deploy -f pom_jar.xmlhtml
validate:驗證工程是否正確,全部須要的資源是否可用。
compile:編譯項目的源代碼。
test:使用合適的單元測試框架來測試已編譯的源代碼。這些測試不須要已打包和佈署。
Package:把已編譯的代碼打包成可發佈的格式,好比jar。
integration-test:若有須要,將包處理和發佈到一個可以進行集成測試的環境。
verify:運行全部檢查,驗證包是否有效且達到質量標準。
install:把包安裝在本地的repository中,能夠被其餘工程做爲依賴來使用。
Deploy:在集成或者發佈環境下執行,將最終版本的包拷貝到遠程的repository,使得其餘的開發者或者工程能夠共享。
clean:清除先前構建的artifacts(在maven中,把由項目生成的包都叫做artifact)。
site:爲項目生成文檔站點。
-Dmaven.test.skip=true 跳過單元測試
|
mvn -f xxx.xml能夠指定pom文件進行構建。java
mvn -s /path/to/user/my-settings.xml 指定settings文件git
mvn dependency:purge-local-repository 刪除本地倉庫github
分析jar包依賴關係web
mvn dependency:analyzespring
mvn dependency:treeapache
mvn dependency:tree > tree.txtwindows
mvn dependency:tree -Dverbose -Dincludes=org.elasticsearch > tree.txttomcat
<build>
<finalName>mywebproj</finalName>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>7.0.0.pre5</version>
</plugin>
</plugins>
</build>
|
<build>
<finalName>mywebproj</finalName>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>7.0.0.pre5</version>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
<stopKey>foo</stopKey>
<stopPort>9999</stopPort>
</configuration>
<executions>
<execution>
<id>start-jetty</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<scanIntervalSeconds>0</scanIntervalSeconds>
<daemon>true</daemon>
</configuration>
</execution>
<execution>
<id>stop-jetty</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
|
相關參數說明app
參數 | 默認值 | 說明 |
---|---|---|
allowSnapshots | false | 是否更新-snapshot快照版 |
artifactId | ${project.artifactId} | 指定artifactId |
generateBackupPoms | true | 是否備份pom文件 |
groupId | ${project.groupId} | 指定groupId |
newVersion | 設置的新版本號 | |
nextSnapshot | false | 更新版本號爲下一個快照版本號 |
oldVersion | ${project.version} | 指定須要更新的版本號可使用缺省‘*' |
processAllModules | false | 是否更新目錄下全部模塊不管是否聲明父子節點 |
processDependencies | true | 是否更新依賴其的版本號 |
processParent | true | 是否更新父節點的版本號 |
processPlugins | true | 是否更新插件中的版本號 |
processProject | true | 是否更新模塊自身的版本號 |
removeSnapshot | false | 移除snapshot快照版本,使之爲release穩定版 |
updateMatchingVersions | true | 是否更新在子模塊中顯式指定的匹配版本(如/項目/版本)。 |
參考 versions-maven-plugin 命令介紹
http://aijezdm915.iteye.com/blog/1335025 maven Nexus入門指南(圖文)
http://blog.csdn.net/wang379275614/article/details/43940259/ Maven倉庫—Nexus環境搭建及簡單介紹
http://121088825.iteye.com/blog/2337515 速度很快的 Maven 遠程倉庫(阿里雲 nexus 倉庫)