hudson安装

1.下载hudson
http://java.net/projects/hudson/downloads
这里我选择的是Hudson ver. 1.386


2.解压hudson,并且放到web(resin)服务目录下,
我这里是/data/www/hudson

3.配置环境变量
export HUDSON_HOME=/data/www/hudson



4.启动resin,就可以在http://localhost:8080/hudson访问

5.添加插件
Hudson Email Extension Plugin
Hudson Subversion Plug-in
Hudson SSH plugin

6.系统设置:
1)执行者数量 10(可以根据实际情况调整)
2)启用安全(默认就可以)
3)配置JDK,

4)配置maven

5)Maven项目配置
全局MAVEN_OPTS
-Xms4096m -Xmx4096m
6)邮件通知


7.新建任务
1)构建一个maven2项目,目前无法支持maven3.0,

2)配置svn

3)设置自动构建的时间

4)Build
先执行maven,然后执行shell



shell的内容:
#!/bin/sh

WORK_DIR=/data/www/hudson/jobs/twitter_deploy_clientWeb/workspace/;
RESIN_WEBAPPS_DIR=/data/www;

ssh [email protected] "/data/shell/resin.sh stop";
sleep 20;

#clean the old deploy
ssh [email protected] "rm -rf $RESIN_WEBAPPS_DIR/client-web.war";

#copy to client
scp $WORK_DIR/target/client-web-1.0-SNAPSHOT.war 192.168.0.2:$RESIN_WEBAPPS_DIR/client-web.war;
ssh [email protected] "unzip -o $RESIN_WEBAPPS_DIR/client-web.war -d $RESIN_WEBAPPS_DIR/twitter;"
ssh [email protected] "/data/shell/resin.sh start";


resin.sh
#! /bin/sh
source /etc/profile
source /root/.bash_profile
/usr/local/resin/bin/resin.sh $1

猜你喜欢

转载自running.iteye.com/blog/830604