May
13
2008
Setting up a Hudson build environment
Posted by: Matt in Uncategorized, tags: Eclipse, Hudson, Maven, SubversionIn 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.
- Get JDK 6.0 (Hudson cannot be built using 5.0 or earlier) and install it.
- Get Subversion and install it.
- Get Maven and install it.
- 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.
- 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.
- In the same dialog, add the M2 environment variable in the user variables with the value “%M2_HOME%\bin” .
- 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 - 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.
- 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.
- Open a new command prompt (Winkey + R then type “cmd” ) and run “mvn –version” to verify that it is correctly installed.
- Make a directory for the workspace and switch to it
- 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 - You’ve just checked out a hudson directory, so switch to it
- Use Maven to do an initial build of everything.
mvn install
- Use Maven to get the sources and Eclipse project files
mvn -DdownloadSources=true eclipse:eclipse
- Import the projects into Eclipse.
- Open Eclipse, select File | Import…, then select Existing Projects into Workspace from the General category.
- Enter as the root directory the hudson directory you were in on the command line.
- Eclipse will scan the directory and find a ton of projects.
- Click Select All and Finish.
- Start Hudson
- Change to the main/war directory under your hudson directory
- 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.
- In Eclipse, set up a remote debugging run configuration.
- Select Run | Open Debug Dialog…
- In the tree to the left, select Remote Java Application.
- Give the run configuration a name (like, say, “Hudson”)
- Select hudson-war as the project, localhost for the host, and 8000 as the port.
- Optionally, check the Allow termination of remote VM box.
- Select Debug. It will save your configuration and attach to your running Hudson.
- 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.

Entries (RSS)