7 Installing and Configuring Hudson for Continuous Integration

Hudson is a popular continuous integration server product. It enables you to define build jobs and manages the execution of those jobs for you. If necessary, it has the ability to scale up to a farm of build servers.

This chapter describes how to install and configure Hudson to automate the build process and how to integrate Hudson with Maven.


Prerequisites for Installing and Configuring Hudson

Before you install Hudson, you must meet the prerequistes.

Ensure that you have the following components of the continuous integration system configured before you begin installing Hudson:

Downloading Hudson

You can download Hudson either as a WAR file or as Linux RPMs.

The latest production version of Hudson can be downloaded directly from the following location:


Hudson is distributed in two distinct versions:

  • WAR file, which can either run as standalone or can be added to an existing application server installation.

  • Linux RPMs compiled for specific operating systems. Package management support in the form of appropriate repositories are available to install the RPM and necessary dependencies.

This document focuses on Oracle Linux and Windows installation. Details for the other operating systems may vary from these. For instructions on various types of installations, see http://wiki.eclipse.org/Hudson-ci/Installing_Hudson.

Installing Hudson

You can install Hudson on Linux or Windows.

  • On Linux:

    On a Linux computer supporting YUM, run the following commands:

    sudo wget -O /etc/yum.repos.d/hudson.repo http://hudson-ci.org/redhat/hudson.repo
    sudo yum check-update
    sudo yum install hudson

    This installs Hudson as a daemon and creates a Hudson user. This user is used by the server to perform build job-related activities.

  • On Windows:

    You must download the Hudson WAR distribution. Then, to install it:

    1. Start Hudson in standalone mode by running the following command:

      java -jar hudson-3.2.1.war
    2. When Hudson starts:

      1. Open the following URL in a web browser:

      2. Navigate to Manage Hudson, then Install as Windows Service. This enables you to configure Hudson as a standard Windows service.

        For instructions, see


Configuring the HTTP Port

If you are using a single host for your artifact repository and continuous integration server, you must change the HTTP port used by Hudson.

To change the HTTP port:

  • On Linux

    This value is located in the /etc/sysconfig/hudson directory with HUDSON_PORT.

  • On Windows

    This value is located in the c:\ciroot\hudson\etc\sysconfig\hudson directory.

Starting Hudson

You can start Hudson and monitor its logs.

To start Hudson:

  • On Linux

    If you have installed Hudson as a service, you can start the application by running the following command:

    /etc/init.d/hudson start

    You can monitor start up by checking the logs in the following directory:


    Run the following command to monitor logs:

    tail -f /var/log/hudson/hudson.log
  • On Windows

    Start Hudson on Windows as a normal service:

    1. Go to Control Panel.

    2. Navigate to Administrative Tools, then Services.

    3. Select the Hudson service and click Start.

    Hudson logs are available in the following location:


Configuring Maven After Startup

After you install Hudson, you must take several steps to configure Maven to work with Hudson.

This section contains the following topics:

Starting Up Hudson for the First Time

The first time you start Hudson, go to the home page to complete the installation:

  1. Open a browser and go to http://localhost:8080 (change the port if you modified it during installation).
  2. In the list of plug-ins that is presented, scroll down to find the Subversion, Maven 3 and Maven 3 SNAPSHOT Monitor options and select these options.
  3. Scroll down to the bottom and click Install.
  4. Click Finish to move to the Hudson home page.

The rest of the configuration in this section is continued from the Hudson home page and assumes that you are logged in.

Configuring the JDK

You must configure the JDK that you intend to use for direct Java build configurations. To configure:

  1. From the Hudson home page, navigate to Manage Hudson, then Configure System.
  2. In the Configure System screen, scroll down to the JDK section and click Add JDK. Deselect the option Install automatically and then enter a name, for example, jdk1.7.0 and add the complete path of your installed JDK.

    For example: /ciroot/product_binaries/jdk1.7.0.

  3. Scroll down to the bottom of the page and click Save.

Specifying the Maven Home

You must specify the Maven 3 location so that Hudson knows where Maven is located. To do so:

  1. From the Hudson home page, navigate to Manage Hudson, then Configure System.
  2. On the Configure System screen, scroll down to the section Maven 3.
  3. Click Add Maven, then deselect the option Install automatically and enter a name and the path to the Maven installation, as shown in the following image:
  4. Scroll down to the bottom of the page and click Save.

Setting Up Maven for Use by Hudson

To utilize Maven settings from Hudson, embed the settings.xml content into a settings object in Hudson's global Maven configuration:

  1. From the Hudson home page, navigate to Manage Hudson, then Maven 3 Configuration.
  2. Click Add.
  3. For Type, select SETTINGS.
  4. Provide a name and optional description.
  5. Find the settings.xml on your file system (that you have configured in Installing and Configuring Maven for Build Automation and Dependency Management). It is located at/$HOME/.m2/settings.xml. Copy the contents into the large text field at the bottom of the page..
  6. Click Save.


Oracle recommends that you replace any localhost URL references in the settings.xml with fully qualified domain names or IP addresses because Hudson builds can eventually occur on non-local build hosts.

Installing Hudson Plug-Ins

Hudson jobs may require job-specific customizations of environment variables. Because Hudson does not support this by default, you must install an additional plug-in. To install the plug-in:

  1. From the Hudson home page, navigate to Manage Hudson, then Manage Plugins.
  2. Select Available.
  3. Select Hudson Setenv Plugin.
  4. Click Install.
  5. After the installation completes, use the restart option in Hudson to enable the plug-in.

Integrating the Repository

To configure automatic builds when changes are checked in, you must configure Hudson to monitor the artifact repository for SNAPSHOT deployment changes. Such changes trigger builds of affected components that have dependencies on the changed artifacts. To configure Hudson to monitor the artifact repository:

  1. From the Hudson home page, navigate to Manage Hudson, then System Configuration.
  2. In the main system configuration panel under System Configuration, select Maven 3 SNAPSHOT Monitor. Enter the path to Maven repository.
  3. In Installing and Configuring the Archiva Maven Repository Manager, you created a continuous integration specific user for continuous integration server access to the repository. Set the User and Password for the continuous integration user.

Monitoring Subversion

In addition to monitoring the artifact repository for updated dependencies, the continuous integration server must constantly check the source control system for updates and trigger project builds accordingly. Unlike repository monitoring, software configuration management monitoring must be uniquely configured per build configuration. As you create new build configurations, you must set the Subversion location information for the related project. For more information about setting the location information, see Automating the Build with Hudson.

Subversion support comes with the base Hudson distribution. Other source control systems may require separate Hudson plug-in installation.

More Information About Hudson

This document is meant as a quick guide for starting and running Hudson and does not provide extensive detail on Hudson operations.

You can find the primary source of the official documentation on Hudson in the following location:


For new users, you can find introductory guides to Hudson in the following location:


The Hudson book is located in the following location: