Maven2 & Continuum 持续整合 (2)
上一篇文章写了 maven & maven-proxy 的安装和配置
这篇文章来说说 continumm 持续整合的安装配置,还是在服务器端作安装和配置。
continuum 能自动根据maven2的工程 pom.xml文件,定时从svn服务器上下载该工程的代码,运行build任务,运行test,并将运行结果通过邮件和MSN的方式通知开发人员。如果代码库没有更新,则不作持续整合,功能相当强。
1. 下载 continuum
下载地址:http://maven.apache.org/continuum/download.html
下载 continuum-
2. 安装 continuum
(1) 创建ci用户,用此用户来完成持续整合的各个任务
# groupadd ci
# useradd ci -g ci
以 ci 用户登录,编辑.bash_profile,添加环境变量,用于ci用户能执行maven和subversion
MAVEN_HOME=/usr/local/maven
SVN_HOME=/usr/local/subversion
PATH=$PATH:$MAVEN_HOME/bin:SVN_HOME/bin
export MAVEN_HOME SVN_HOME PATH
增加maven的本地配置,maven 的setting 有全局和本地的2个配置文件,本地用户使用maven,依据$HOME/.m2/setting.xml的配置。
简单的配置方法,可以将上篇文章中的 setting.xml 拷贝过来即可,这个配置已经配好了使用 maven-proxy 来获得代码库。
$ cd
$ mkdir .m2
$ cd .m2
$ cp /usr/local/maven/conf/setting.xml .
这样 ci 用户就可以使用 $HOME/.m2/setting.xml中的配置来使用 maven了,当maven需要下载依赖的库文件的时候,会从maven-proxy上下载,由于maven-proxy部署在局域网内,大大的提高了代码库的下载速度。其二 setting.xml中配置了 localRepository的路径,这样某个用户下载过后,其他用户也不用再下载了。
(2) 安装 continuum
$ tar xvfz continuum-1.0.3-bin.tar.gz
得到 continuum-1.0.3 目录
第一次运行continuum
$ cd continuum-1.0.3/bin/linux
$ ./run.sh start
看 $HOME/continuum-1.0.3/logs/*.log,第一次运行会失败,这是正常的,因为continuum的自带的数据库没有建好,第一次运行会自动创建库。
第二次运行continuum
$ ./run.sh stop
$ ./run.sh start
看 $HOME/continuum-1.0.3/logs/*.log, 看到部署了application continuum的信息,默认端口8080。
我们需要修改一下这个端口,我们还要修改其他配置,如邮件服务器,邮件发送者,MSN发送者等。
$ ./run.sh stop
$ cd ../../apps
$ ll
看到
drwxrwxr-x 9 ci ci 4096 May 2 16:35 continuum
-rw-r--r-- 1 ci ci 9050570 May 2 18:56 continuum-plexus-application-1.0.3.jar
$ cd continuum
$ cd conf
$ vi application.xml
修改端口,注意红色黑体字部分
找到 webapps 一节,修改端口为8090。
<service>
<id>jetty</id>
<configuration>
<webapps>
<webapp>
<file>${plexus.home}/lib/continuum-web-1.0.3.jar</file>
<context>/continuum</context>
<extraction-path>${plexus.home}/webapp</extraction-path>
<listeners>
<http-listener>
<port>8090</port>
</http-listener>
<!--
<proxy-http-listener>
<port>8090</port>
<proxy-host>localhost</proxy-host>
<proxy-port>80</proxy-port>
</proxy-http-listener>
-->
</listeners>
</webapp>
</webapps>
</configuration>
</service>
设置邮件SMTP服务器参数,主要修改见红色黑体字部分。
设置 from-mailbox 发件人邮箱,这里是 ci.gehouse@163.com
设置 smtp-host SMTP主机名,这里是 smtp.163.com
设置 smtp 发信认证的用户名和密码 ci.gehouse@163.com,密码需要使用正确的,这里隐去了,用****代替。
去掉了 smtp 的 ssl 设置
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
设置 MSN 通知的参数,注意红色黑体字部分。
信息发送人 from-address,这里是 ci.gehouse@hotmail.com
信息发送人密码 from-password,这里隐去了,用****代替
设置好后,ci每次build后,会以ci.gehouse@hotmail.com 登录MSN,然后给开发人员发送build任务执行的结果,并给出查看结果的连接url.
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
配置修改好后,可以在此运行continuum。
创建工作目录,编译目录,部署目录
$ cd
$ mkdir build work deploy
第三次运行 continuum
$ cd continuum-
$ ./run.sh start
给continuum服务器配置域名 ci.gehouse.cn
在开发环境浏览器地址栏输入 http://ci.gehouse.cn:8090/continuum
可以看到continuum的页面,说明安装成功。
第一次访问 http://ci.gehouse.cn:8090/continuum 会提示添加管理员用户,设置管理员用户密码
用管理员用户登录后,会提示设置项:
Working Directory 设置为 /home/ci/work
Build Output Directory 设置为 /home/ci/build
Deployment Repository Directory 设置为 /home/ci/deploy
Base URL 设置为 http://ci.gehouse.cn:8090/continuum/servlet/continuum
其他设置如公司名,公司LOGO等,设好就可以了。
下篇文章,我们说说,创建一个工程,让后提交给continuum,让它来完成持续整合。