使用maven2 进行团队配置 整理中
对于团队来说,建立统一的开发环境是必须的,而maven能很好帮助建立统一的环境。下面就介绍如何更有效的进行统一的配置。
准备工作:
?? 下载必须的软件:[url]maven2: http://maven.apache.org/download.html [/url]最主要的
maven-proxy:用来代理repository,使用代理来访问多个远程库
http://maven-proxy.codehaus.org/continuum:一个不错的持续整合工具,用于自动build。支持ant,maven
http://maven.apache.org/continuum/svn:版本控制工具
创建一致的开发环境??
??? 在共享的开发环境中,更好的建议是保持maven的两个不同的配置文件分别管理,包括共享和用户自定义设置。共同的配置包括在安装目录中,而单独的开发设置保存在用户本地目录。
??? 全局的配置文件settings.xml
- ...<ciManagement>??????<system>continuum</system>??????<url>??????????http://localhost:8080/continuum??????????<notifiers>??????????????<notifier>??????????????????<type>mail</type>??????????????????<configuration>??????????????????????<address>youremail@yourdomain.com</address>??????????????????</configuration>??????????????</notifier>??????????</notifiers>??</ciManagement>??...??<scm>??????<connection>??????????scm:svn:file://localhost/c:/mvnbook/svn/proficio/trunk??????</connection>??????<developerConnection>??????????scm:svn:file://localhost/c:/mvnbook/svn/proficio/trunk??????</developerConnection>??</scm>??...??<distributionManagement>??????<site>??????????<id>website</id>??????????<url>??????????????file://localhost/c:/mvnbook/repository/sites/proficio??????????????/reference/${project.version}??????????</url>??????</site>??</distributionManagement>??
提交相应的pom,然后执行mvn install
如果你返回http://localhost:8082/continuum,你会看到相应的项目列表。
一旦你登录后,你可以选择mavan 2.0项目用于增加相应的项目。你可以增加你的url或者提交你的本地内容。
你可以使用本地pom url,如下file://localhost/c:mvnbook/proficio/pom.xml
在提交了此url后,continuum将会返回相应的成功信息。
以下的原则用于更好的帮助持续整合:
早提交,经常提交:当用户经常提交时,持续整合是最有效的。这并不意味着,提交不正确的代码。
经常运行build:用于最快检测失败
尽快修正失败:当失败发生时,应该马上修正失败
建议一个有效的版本
运行clean build
运行复杂的综合测试
build所有的项目结构分支
持续运行项目的拷