In my last post I talked about getting involved with the Hudson project. In this post I will describe the steps I took to set up my build environment.

  1. Get JDK 6.0 (Hudson cannot be built using 5.0 or earlier) and install it.
  2. Get Subversion and install it.
  3. Get Maven and install it.
    1. Unzip the distribution archive, i.e. apache-maven-2.0.9-bin.zip to the directory you wish to install Maven 2.0.9. These instructions assume you chose “C:\Program Files\Apache Software Foundation\” . The subdirectory apache-maven-2.0.9 will be created from the archive.
    2. Add the M2_HOME environment variable by opening up the system properties (WinKey + Pause), selecting the “Advanced” tab, and the “Environment Variables” button, then adding the M2_HOME variable in the user variables with the value “C:\Program Files\Apache Software Foundation\apache-maven-2.0.9″ . Note : for Maven < 2.0.9, be sure that the M2_HOME doesn’t have a ‘\’ as last character.
    3. In the same dialog, add the M2 environment variable in the user variables with the value “%M2_HOME%\bin” .
    4. In the same dialog, add the MAVEN_OPTS environment variable in the user variables to specify JVM properties, and set it to the value
      -Xrunjdwp:transport=dt_socket,server=y,address=8000,suspend=n -Xms256m -Xmx512m -Xdebug
    5. In the same dialog, update/create the Path environment variable in the user variables with the value %M2% somewhere in the value to add maven available in the command line.
    6. In the same dialog, make sure that JAVA_HOME exists in your user variables or in the system variables and it is set to the location of your JDK, e.g. C:\Program Files\Java\jdk1.6.0_03 and that %JAVA_HOME%\bin is in your Path environment variable.
    7. Open a new command prompt (Winkey + R then type “cmd” ) and run “mvn –version” to verify that it is correctly installed.
  4. Make a directory for the workspace and switch to it
  5. Use Subversion to get all the source code:

    svn co https://svn.dev.java.net/svn/hudson/trunk/hudson –username guest
    or
    svn co https://svn.dev.java.net/svn/hudson/trunk/hudson –username dev.java.net.id –password dev.java.net.password
  6. You’ve just checked out a hudson directory, so switch to it
  7. Use Maven to do an initial build of everything.

    mvn install

  8. Use Maven to get the sources and Eclipse project files

    mvn -DdownloadSources=true eclipse:eclipse

  9. Import the projects into Eclipse.
    1. Open Eclipse, select File | Import…, then select Existing Projects into Workspace from the General category.
    2. Enter as the root directory the hudson directory you were in on the command line.
    3. Eclipse will scan the directory and find a ton of projects.
    4. Click Select All and Finish.
  10. Start Hudson
    1. Change to the main/war directory under your hudson directory
    2. Use Maven to fire it up:

      mvn hudson:run

      At this point you can point your browser to http://localhost:8080 and play with Hudson.
  11. In Eclipse, set up a remote debugging run configuration.
    1. Select Run | Open Debug Dialog…
    2. In the tree to the left, select Remote Java Application.
    3. Give the run configuration a name (like, say, “Hudson”)
    4. Select hudson-war as the project, localhost for the host, and 8000 as the port.
    5. Optionally, check the Allow termination of remote VM box.
    6. Select Debug. It will save your configuration and attach to your running Hudson.
    7. Suggestion: Add this run configuration to your favorites in Eclipse.

There may be better ways to do this, and I would be glad to know of them. For now, this works for me.

Leave a Reply