Audience: Hudson developers who use Eclipse as their IDE
Goal: To be able to modify Hudson source code, and run/debug it within Tomcat.
Author: Brian Westrich (bw@mcwest.com)
Prerequisites: You have already completed the steps currently at Building Hudson, up to and including running "mvn ... eclipse:eclipse".
Make sure you're using Java 6
Hudson does not compile on Java5.
Window, Preferences...
Make sure JDK6 is present and checked.
Set your M2_REPO variable
Window, Preferences....
Click New, then specify your M2_REPO location, for example:
Import the modules you want to work with
e.g. to work with the Perforce plugin ...
 | there is an issue that prevents generation of the eclipse files (notably the .classpath file) for some of the Hudson plugins (see details). Re-running
mvn -o -DdownloadSources=true eclipse:eclipse will sometimes resolve this. |
Other tips
Setting up hudson to run as web app within tomcat/eclipse (using eclipse 3.3, tomcat 6.0, sysdeo tomcat plugin):
- Add the plugin project you are currently working on into Tomcat's classpath using the Sysdeo plugin (Preferences, Tomcat, Advanced, ...)
- Download a recent stable Hudson war.
- Copy war to tomcat webapps.
- Start tomcat. This will explode the war into the tomcat webapps directory (needed for subsequent step).
- Limitation: This setup does not deploy any non-Java artifacts to the web application. If you update any of these (e.g. html files), you'll need to manually copy these to the exploded directories in the tomcat webapps directory.
 | If you need to change any of the main modules (e.g. hudson-core), you must import all of them into Eclipse as they depend on each other. e.g.
|
If you are changing multiple modules, the most reliable way to have the correct version appear first on the tomcat classpath is to add the imported version of the module to the classpath of the plugin you're debugging, then only add the plugin project to Tomcat's classpath. For example, this shows the Hudson-core project added to the build path of the perforce plugin.
After you add the hudson-core project to the classpath, use the 'Order and Export' tab to move the hudson-core project before the jar version (in M2_REPO) of hudson-core. Also, you must check the checkbox to the left of hudson-core, otherwise Tomcat will not be able to load any of the classes in hudson-core.
Use Mylyn and the Hudson issue tracker
It is possible to configure Mylyn so it will connect to the Hudson issue tracker. To be able to connect to the tracker you need to install the CollabNet Desktop plugin.
Task repository
When the plugin has been installed, create a new Task repository with the following settings:
Task query
To create a query to the issue tracker
- Create a new Mylyn query
- Select the newly create task repository
- Select "Create query using form"
- Enter a name for the query
- Set the component to Hudson
- Configure the query
!