maven的scm插件介绍及使用示例
格式說明
scm:svn:svn://[username[:password]@]server_name[:port]/path_to_repository
scm:svn:svn+ssh://[username@]server_name[:port]/path_to_repository
scm:svn:file://[hostname]/path_to_repository
scm:svn:http://[username[:password]@]server_name[:port]/path_to_repository
scm:svn:https://[username[:password]@]server_name[:port]/path_to_repository
Examples
scm:svn:file:///svn/root/module
scm:svn:file://localhost/path_to_repository
scm:svn:file://my_server/path_to_repository
scm:svn:http://svn.apache.org/svn/root/module
scm:svn:https://username@svn.apache.org/svn/root/module
scm:svn:https://username:password@svn.apache.org/svn/root/module
Maven中為我們集成了軟件配置管理的(SCM:Software Configuration Management)功能,他可以支持我們常用SVN、CVS等,到現在我使用的1.8.1版本,共支持18個命令:
scm:branch - branch the project(創建項目的分支)
scm:validate - validate the scm information in the pom(校驗SCM的配置信息)
scm:add - command to add file(增加一個文件)
scm:unedit - command to stop editing the working copy(停止編輯當前COPY)
scm:export - command to get a fresh exported copy(拉一個全新的分支)
scm:bootstrap - command to checkout and build a project(checkout并編譯工程)
scm:changelog - command to show the source code revisions(顯示源碼版本)
scm:list - command for get the list of project files(列出工程的文件)
scm:checkin - command for commiting changes(提交變更)
scm:checkout - command for getting the source code(獲取源碼)
scm:status - command for showing the scm status of the working copy(獲取本地項目的狀態)
scm:update - command for updating the working copy with the latest changes(從服務器獲取最新的版本)
scm:diff - command for showing the difference of the working copy with the remote one(比較本地與遠程服務器的差異)
scm:update-subprojects - command for updating all projects in a multi project build(更新子項目)
scm:edit - command for starting edit on the working copy(編輯)
scm:tag - command for tagging a certain revision(打標簽)
常用命令介紹
而我們常用只有以下這兩個命令:
Usage
The SCM Plugin maps a lot of commands to a variety of scm implementations. But there are only 2 frequently used commands:
checkin - 提交變更
update - 從服務器上獲取最新的版本
配置及使用
其它的SCM都有自己獨特的命令來操作提交變更、或從服務器上獲取最新的源嗎,如SVN及CVS的操作就很不相同,使用Maven擔任的SCM機制,就可以使得SCM的操作變得統一,以下是一個SVN配置示例,將以下的示例配置到pom.xml文件中
…
jar
1.0-SNAPSHOT
SCM Sample Project
http://somecompany.com
scm:svn:http://somerepository.com/svn_repo/trunk
scm:svn:https://somerepository.com/svn_repo/trunk
http://somerepository.com/view.cvs
…
照這樣配置好的,現在我們要做提交或者更新,就按如下按行命令
提交:
mvn -Dmessage=”” scm:checkin
獲取最新版本:
mvn scm:update
SCM支持的連接類型
SCM支持兩種連接類型:connection 及 developerConnection。
以下是一個連接類型為connection的配置示例:
…
[…]
org.apache.maven.plugins
maven-scm-plugin
1.8.1
connection
…
…
…
以下是一個連接類型為developerConnection的配置示例:
…
…
org.apache.maven.plugins
maven-scm-plugin
1.8.1
developerConnection
…
…
…
總結
以上是生活随笔為你收集整理的maven的scm插件介绍及使用示例的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: PCWorld:谷歌成下一个微软式企业1
- 下一篇: 游戏服务器架构通识 BigWorlds丨