---
title: "Hudson-Tomcat-Ant -SVN 配置"
author: "yhef"
date: "2012-12-23T14:11:40Z"
tags: []
categories: ["研发管理"]
slug: "hudson-tomcat-ant-svn"
draft: false
lastmod: "2012-12-23T14:19:38Z"
id: 1752569
url: "https://yhef.iteye.com/blog/1752569"
---

一、下载、部署

1：下载Tomcat 、 Ant 、hudson-2.2.1.war

2：将hudson部署到tomcat

二、配置

1：配置Hudson的JDK

    **系统管理**--&gt;**系统设置**--&gt;JDK

2：下载Tomcat自动部署插件

    **系统管理**--&gt;**插件管理**--&gt;可选插件--&gt;搜索"*Tomcat*"关键字，选择”Hudson Deploy Plugin“，点击右下角”安装“。

3：新建任务

4：配置**任务相关参数**

  4.1：代码本地暂存目录

Advanced Project Options--&gt;Use custom workspace；输入文件路径

  4.2：代码管理软件配置

Source Code Management--&gt;Subversion；

Repository URL：

  4.3：构建频率

Build Triggers--&gt;Poll SCM；格式：\*/15 * * * *

  4.4：构建命令

Build--&gt;Execute Windows Batch Command

例子：cd xxxxWarName

 ant war -Dtomcat.home=E:\\yangf\\app\\apache-tomcat-7.0.33

说明：-Dtomcat.home，表示，用这里的值替换build.xml中定义的值

  4.5：部署Tomcat

Post-build Actions--&gt;Deploy war/ear to a container

WAR/EAR files:ssi\\build\\ssi.war

Container:Tomcat 7

Manager user name：tomcat

Manager password：tomcat

Tomcat URL：http://localhost:8080/

 

补充说明：

1：配置Tomcat的用户权限

tomcat-users.xml：

 

```
<role rolename="admin"/>  
  <role rolename="manager"/>
  <role rolename="tomcat"/>
  <role rolename="manager-gui"/><!-- allows access to the HTML GUI and the status pages -->
  <role rolename="manager-script"/><!-- allows access to the text interface and the status pages -->
  <role rolename="manager-jmx"/><!-- allows access to the JMX proxy and the status pages -->
  <role rolename="manager-status"/><!-- allows access to the status pages only -->
  <user username="tomcat" password="tomcat" roles="tomcat,manager-gui,manager-script,manager-jmx,admin,manager"/>
```

 

2：批处理脚本里用的是ant进行编译，所以，需要提前配置好ant\_home