|
Building Hudson requires JDK1.6.x and Maven 2.x (If using a 2.0.x release, then 2.0.6 or greater is required) . Issues:
To build Hudson so that you can make modifications, follow the steps below: // check out the workspace $ svn co https://svn.dev.java.net/svn/hudson/trunk/hudson $ svn co https://svn.dev.java.net/svn/hudson/trunk/www $ cd hudson // use maven2 for build $ mvn install If you just want to build the core without all the plugins, do: $ cd hudson/main $ mvn install If it asks for username/password, you can either use your java.net ID, or simply specify "guest" as the user name and empty password.
The first build will take a while, because it has to download million jars from all over the world. You'll also need to have Java6 to build Hudson (even though Hudson will run on Java5. Mac users, Java 6 is only available for Core 2 Duo machines - see http://landonf.bikemonkey.org/2009/05/17#OpenJDK6_MacPorts.20090516 for a beta of OpenJDK for 10.4 and 10.5)
At the end you should have hudson/main/war/target/hudson.war, which is the hudson you just built.
Configure work environmentTo work on the Hudson code productively, you should generate your IDE project files (note: these commands run maven offline (i.e. -o), which is faster but might not work correctly if you have not just run a "mvn install"): // if you are using IntelliJ $ mvn -DdownloadSources=true idea:idea // if you are using Eclipse $ mvn -DdownloadSources=true eclipse:eclipse NetBeans (6.7+) users can just open the module directly, with File -> Open Project and navigate to the hudson folder. There is a step-by-step guide to working with Eclipse once you've run the above commands. Due to a bug in Eclipse, Eclipse users may need to remove src/main/resources from the source folder list after projects are imported to the workspace. See this e-mail thread for more details.
Debugging HudsonMaven Jetty plugin offers a convenient debugging environment, but for a few reasons we maintain a modified version of the plugin under a different name, so the plugin name is different but the configuration parameters are the same. Do the following to run Hudson under the debugger, and open http://localhost:8080/ in your browser: $ cd main/war $ export MAVEN_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8000,suspend=n" $ mvn hudson-dev:run This will launch maven with the debugger port for 8000. You can connect to this port from your IDE by using the remote debug feature. Once this starts running, keep it running. Jetty will pick up all the changes automatically.
Other Tips
CreditsThe sponsor statement from YourKit Java Profiler, which gave us a free license for the Hudson project.
|

Comments (7)
Jul 08, 2008
Karl Palsson says:
Under debugging hudson, have you got any advice on how to debug plugins?Under debugging hudson, have you got any advice on how to debug plugins?
Aug 26, 2008
Kohsuke Kawaguchi says:
See Plugin tutorial for how to develop and debug plugins.See Plugin tutorial for how to develop and debug plugins.
Nov 18, 2008
Philippe Martel says:
[content removed by the poster][content removed by the poster]
Nov 26, 2008
yongjun says:
I have a question about the IDE eclipse. I followed the build steps and download...I have a question about the IDE eclipse. I followed the build steps and downloaded hudson source codes. If I use eclipse3.2, build always failed. The common error is 'some type is collides with a package". Then I change to eclipse3.4, there are still some compile errors but I can deal with them finally.
So Kohsuke, may you suggest which IDE we can use for hudson development?
BTW, I am in solaris 10, x86. The top support Eclipse version is 3.2.
Thank you very much.
Jun 09
Pete says:
Recently I have had issues with building. If I do this before hand, it wor...Recently I have had issues with building. If I do this before hand, it works fine.
Sep 01
Eric Badiere says:
This is my first attempt at building hudson and I am getting the following when ...This is my first attempt at building hudson and I am getting the following when I run 'mvn -o install' :
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Internal error in the plugin manager executing goal 'org.jvnet.hudson.tools:maven-hpi-plugin:1.31:apt-compile': Unable to find the mojo 'org.jvnet.hudson.tools:maven-hpi-plugin:1.31:apt-compile' in the plugin 'org.jvnet.hudson.tools:maven-hpi-plugin
Any help wold be appreciated.
Oct 14
Clifton Craig says:
I get a compile error when building from source: [INFO] [stapler:apt-compile] ...I get a compile error when building from source:
[INFO] [stapler:apt-compile]
[INFO] Compiling 561 source files to /Users/cliftoncraig07/java-apps/Hudson-src/hudson/main/core/target/classes
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Fatal error compiling
Embedded error: Error while executing the external compiler.
error=2, No such file or directory
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 minute 31 seconds
[INFO] Finished at: Wed Oct 14 19:07:23 EDT 2009
[INFO] Final Memory: 65M/81M
[INFO] ------------------------------------------------------------------------
cliffmac:main cliftoncraig07$ javac -version
javac 1.6.0_13