Building Hudson

Requirements

Build Steps

Check out source

Main development is tracked on Github at https://github.com/hudson/hudson in terms of source code as well as pull requests for modifications. Follow the usual github workflow for contributions.

Check out the main repo with:

git clone git@github.com:hudson/hudson.git

You can also use the java.net mirror to check out if you prefer. It will ask for username/password, you can either use your java.net ID, or simply specify "guest" as the user name and empty. password.

git clone git://java.net/hudson~git

Build

cd hudson
mvn clean install

The github repository mentioned above is where the core of Hudson is located, i.e. not the plugins. In the root of the repository is a file called changelog.html, which you should update if/when you become a committer.

The first build may take a while, because it has to download all required dependencies and plugins and the transitive dependencies from the Maven repository.

If it succeeds with BUILD SUCCESSFUL at the end, you are good to go. You can find the web archive in hudson-war/target/ and start it your freshly build Hudson with

cd hudson-war/target
java -jar hudson.war

Debugging Hudson

Maven 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:

# To change the port run mvnDebug hudson-dev:run -Dport=9090
$ cd main/war
$ mvnDebug 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.

  1. When you make changes to view files in core/src/main/resources, just hit F5 in your browser to see the changes.
  2. When you make changes to static resources in war/resources, just hit F5 in your browser to see the changes.
  3. When you change Java source files. Compile them in your IDE and Jetty should pick that up. You don't need to run mvn at all for this.
  4. NetBeans users can just hit Debug with main/war open.

Other Tips

  1. If you have trouble that isn't addressed here, please send email to the Hudson dev list. The developers all read that list frequently. You might not get an answer for a long time if you post your questions as comments to this page.
  2. Setting up a local Maven repository manager can considerably speed up your Hudson builds, and make life with Maven more pleasant in general. Click here for instructions on how to set up the Nexus Maven Repository Manager for building hudson.

Credits

The sponsor statement from YourKit Java Profiler, which gave us a free license for the Hudson project.

Open-source license for YourKit Java Profiler
YourKit is kindly supporting open source projects with its full-featured Java Profiler. YourKit, LLC is creator of innovative and intelligent tools for profiling Java and .NET applications. Take a look at YourKit's leading software products: YourKit Java Profiler and YourKit ASP.NET Profiler
Open-source license for StackProbe Profiler
StackProbe is kindly supporting open source projects with its profiler, StackProbe Profiler

Labels:

Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.
  1. 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?

    1. 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.

      1. Dec 08, 2010

        RaghavendraSiddappa says:

        when I try to add AuthType SSPI SSPIAuth On SSPIAuthoritative On SSPIOf...

        when I try to add
        AuthType SSPI
        SSPIAuth On
        SSPIAuthoritative On
        SSPIOfferBasic On
        SSPIBasicPreferred On
        to my subversion.conf file so that subversion and hudson are integrated/configured, and try to re-start my subversion is failing, Kindly suggest. Currently my subversion.conf file looks like:

        <Location /svn>
        DAV svn
        SVNListParentPath On
        SVNParentPath C:/Users/Raja/svn-repos

        AuthType Basic
        AuthName "Subversion Repository"
        AuthUserFile c:\etc\svn-auth-file
        Require valid-user
        AuthzSVNAccessFile c:/etc/svn-acl

        </Location>

        Appreciate your help/suggestion....

  2. 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.

  3. Jun 09, 2009

    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. 

    # 177 used below is the minimum, using 256M would allow for future needs.
    
    MAVEN_OPTS="-Xmx177M"
    mvn -Dmaven.test.skip=true install  
    
  4. Sep 01, 2009

    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.

  5. Oct 14, 2009

    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

  6. Dec 02, 2009

    Lucky Luke says:

    Hi I am releatively new to Hudson. I get the following error when i try to run ...

    Hi

    I am releatively new to Hudson. I get the following error when i try to run mvn -e install -Dmaven.test.skip=true

    .

    .

    .

    .

    .

    [INFO] [enforcer:display-info

    Unknown macro: {execution}

     

    ]
    [INFO] Maven Version: 2.1.0
    [INFO] JDK Version: 1.6.0_13 normalized as: 1.6.0-13
    [INFO] OS Info: Arch: x86 Family: windows Name: windows xp Version: 5.1
    [INFO] [site:attach-descriptor]
    [INFO] [install:install] 

    .

    .

    .

    .

     [resolveArtifact] Copying C:\Documents and Settings\rajesh.nair\.m2\repository\c
    om\sun\winsw\winsw\1.8\winsw-1.8-bin.exe to D:\Java\EclipseWorkspace\svn\hudson{color}
    trunk\hudson\main\core\target\classes\windows-service\hudson.exe
    [INFO] Executed tasks
    [INFO] [resources:resources]
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] Copying 2432 resources
    [INFO] [stapler:apt-compile]
    [INFO] Compiling 583 source files to D:\Java\EclipseWorkspace\svn\hudson\trunk\h
    udson\main\core\target\classes
    [INFO] ------------------------------------------------------------------------
    [ERROR] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Compilation failure

    D:\Java\EclipseWorkspace\svn\hudson\trunk\hudson\main\core\src\main\java\hudson{color}
    os\windows\ManagedWindowsServiceLauncher.java:[51,0] cannot access org.kohsuke.j
    interop.JIProxy
    class file for org.kohsuke.jinterop.JIProxy not found
    import static org.jvnet.hudson.wmi.Win32Service.Win32OwnProcess;

    D:\Java\EclipseWorkspace\svn\hudson\trunk\hudson\main\core\src\main\java\hudson{color}
    os\windows\ManagedWindowsServiceLauncher.java:[51,0] cannot access org.kohsuke.j
    interop.JIProxy
    class file for org.kohsuke.jinterop.JIProxy not found
    import static org.jvnet.hudson.wmi.Win32Service.Win32OwnProcess;

    D:\Java\EclipseWorkspace\svn\hudson\trunk\hudson\main\core\src\main\java\hudson{color}
    os\windows\ManagedWindowsServiceLauncher.java:[140,64] cannot find symbol
    symbol  : method cast(java.lang.Class<org.jvnet.hudson.wmi.Win32Service>)
    location: interface org.jvnet.hudson.wmi.SWbemObject

    D:\Java\EclipseWorkspace\svn\hudson\trunk\hudson\main\core\src\main\java\hudson{color}
    os\windows\ManagedWindowsServiceLauncher.java:[145,24] cannot find symbol
    symbol  : variable Win32OwnProcess
    location: class hudson.os.windows.ManagedWindowsServiceLauncher

    [INFO] ------------------------------------------------------------------------
    [INFO] Trace
    org.apache.maven.BuildFailureException: Compilation failure
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
    ultLifecycleExecutor.java:699)
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLi
    fecycle(DefaultLifecycleExecutor.java:540)
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defau
    ltLifecycleExecutor.java:519)
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan
    dleFailures(DefaultLifecycleExecutor.java:371)
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen
    ts(DefaultLifecycleExecutor.java:332)
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi
    fecycleExecutor.java:181)
            at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:356)
            at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:137)
            at org.apache.maven.cli.MavenCli.main(MavenCli.java:356)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
            at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
            at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)

            at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
    Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation fail
    ure
            at org.kohsuke.stapler.AbstractCompilerMojo.execute(AbstractCompilerMojo
    .java:508)
            at org.kohsuke.stapler.CompilerMojo.execute(CompilerMojo.java:111)
            at org.kohsuke.stapler.AptMojo.execute(AptMojo.java:21)
            at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPlugi
    nManager.java:483)
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
    ultLifecycleExecutor.java:678)
            ... 16 more

    Can someone help me figure out what I am doing wrong?

    Thanks,

    LL

    1. Sep 23, 2010

      Vishal says:

      Any idea on the solution for above issue.? I am facing the same. :(

      Any idea on the solution for above issue.? I am facing the same. :(

  7. Mar 25, 2010

    Mark Michaelis says:

    I had problems checking out Hudson on Windows. Thanks to this post I found the r...

    I had problems checking out Hudson on Windows. Thanks to this post I found the reason and the solution: The problem is the 255 character limit of Windows which you can workaround with absolute paths. So on Windows you might want to call:

    C:\dev> svn co https://svn.dev.java.net/svn/hudson/trunk/hudson \\?\C:\dev\hudson
    C:\dev> svn co https://svn.dev.java.net/svn/hudson/trunk/www \\?\C:\dev\www
    

    Still having problems that download is sometimes interrupted having problems to move the entries-file. Read some hints saying that the virus scanner might be the reason. But although I thought problems got better after I disabled the virus scanner the problems didn't not vanish completely.

  8. Jul 06, 2010

    Jason Robinson says:

    Does the SVN repository have case sensitive file names?  I found that there...

    Does the SVN repository have case sensitive file names?  I found that there are 2 directories with the same name (below) that differ only in the case of letters used.  This is causing issues using "SVN co" on Win7x64 cmd line.
    www2\download\plugins\PerfPublisher
    www2/download/plugins/perfpublisher