Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Hudson Continuous Integration Server

Though Hudson is a Java project, it can easily build your .NET applications. You configure Hudson easily via the Web interface rather than tweaking XML. With plenty of plug-ins available to .NET projects, Hudson provides plenty of powerful features.


advertisement

ohsuke Kawaguchi, a staff engineer at Sun Microsystems, released Hudson in February of 2005. Since that time, Java developers have adopted Hudson as their continuous integration server in greater and greater numbers. From February 1 through February 7 of this year, users downloaded Hudson 2855 times.

Java developers use Hudson for three major reasons: ease of installation, ease of configuration, and ease of extensibility. Additionally, Hudson handles distributed builds across multiple platforms very well. A single Hudson master can control multiple Hudson slaves installed on different operating systems. My team runs our Hudson master on Linux with a Windows slave when we have jobs that require Windows. Hudson is truly easy and enjoyable to use. Fortunately, through some .NET-specific plug-ins, .NET developers can have that same ease of use.

Hudson incorporates a simple plug-in model that has encouraged the community to author and submit over 100 plug-ins to the master Hudson repository. An additional 100 unofficial plug-ins appear in the Hudson usage statistics. While many of those extensions focus on the Java core for the Hudson community, there are enough Microsoft-specific and general-use plug-ins to make Hudson worth a serious investigation. The .NET offerings include MSBuild, NAnt, MSTest, and FxCop. In addition, Hudson has easy integration with source control systems including Subversion, Git, Team Foundation Server, Visual Source Safe, CVS, and others. See the sidebar "More Plug-ins" for descriptions of more useful extensions to the Hudson system.



I will cover the initial installation of Hudson and setting up a complete build for an example project. My project will include integrating with Google Code for source control and source browsing, compiling with MSBuild, executing NUnit tests, publishing test results, and publishing build artifacts.

Downloads

To get started, you’ll need to download a few resources. You should get the latest versions for all downloads unless explicitly stated otherwise.

Hudson

Download Hudson via the "Downloads" link on the left side of the page. I will show the process for installing release 1.280, but Hudson releases frequently, so that will probably not be the latest version by the time you read this.

NUnit

The example project uses NUnit as its testing framework. My example for this article will integrate the NUnit console runner with the Hudson build. You can download NUnit here. I'll use NUnit version 2.4.8 for .NET Framework 2.0, which is compatible with .NET 3.5.

.NET Framework

You probably already have the .NET Framework installed. The sample project requires .NET 3.5. If you do not already have .NET 3.5, install it via Windows Update.

Java Runtime Environment (JRE)

You probably already have this installed as well. Unless you changed the default installation location for Java, you can determine your Java version with this command:

C:\>java -version

You should see something like:

java version "1.6.0_07"
Java(TM) SE Runtime Environment 
(build 1.6.0_07-b06)

If it's not already installed, you can download the latest JRE here: Click the download button for "JRE 6 update 12." Follow the prompts and selections to download the Windows JRE. After downloading the JRE, launch the .exe file and follow the prompts to complete the installation.

Installation

To get Hudson up and running, simply start Hudson from a command prompt, and then ask Hudson to install itself as a Windows service. Before you start, you need to consider a couple of different configuration, covered in the next sections.

HTTP Port

First, you need to decide which port you would like Hudson to run on. The default port is 8080, but if you wish to use a different port, you can override the default with the httpPort option as described below.

Hudson Home

Next, you need to determine the Hudson installation directory. Hudson keeps all files including configuration and workspaces in the same root directory, so be sure to install Hudson on a disk that has plenty of room to handle working copies, compiled binaries, and archived builds. The default installation directory for Hudson is:

C:\Documents and Settings\<user>\.hudson

Start Hudson

 
Figure 1. The Hudson Home Page: The Hudson home page lets you create new jobs and shows builds in the queue.

Open a command prompt and navigate to the directory containing the downloaded hudson.war file. To run Hudson with the default configuration, issue the following command:

java -jar hudson.war

You can override the Hudson home directory using the HUDSON_HOME environment variable. To change the directory Hudson works from and the port that Hudson runs on, use this command:

java -DHUDSON_HOME=<dir> -jar hudson.war 
--httpPort=<port>

Assuming that you started Hudson on the default port, verify your Hudson installation by pointing your browser to http://localhost:8080/. You should see the Hudson home page as shown in Figure 1.

Editor's Note: This article was first published in the March/April, 2009 issue of CoDe Magazine, and is reprinted here by permission.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap