Due to some maintenance issues, this service has been switched in read-only mode, you can find more information about the why

and how to migrate your plugin documentation in this blogpost

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Current »

Hudson runs significant amount of code inside the Maven process for the native maven2 job type, and during the plugin development one would often like to debug this. Here's how you do it:

During development

Hudson looks at the system property "hudson.maven.debugPort" and if this is set, every managed Maven process is launched with this port as the debugger port. Therefore, if you run mvn -Dhudson.maven.debugPort=5001 hpi:run, then you can start a build normally from Hudson, then attach a debugger to port 5001 to see what's going on inside the managed Maven process.

If the plugin doesn't show up in the UI, run mvn clean hpi:run to force the regeneration of the Jelly bindings.

Eclipse users might separate Eclipse generated classes by running mvn -DdownloadJavadocs=true -DoutputDirectory=target/eclipse-classes eclipse:eclipse when generating configuration.

Debug jobs selectively

The previous approach causes every job to launch with the debugger port, but you can also selectively enable the debugger support. This can be even used on the production system, and therefore very handy if you need to trouble-shoot a problem in a live system.

To do so, click "Advanced..." under the build section and add "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=5001" to the MAVEN_OPTS field. (And when you do this, there's no need to have the hudson.maven.debugPort system property set. In this way, only builds of this job will be started with the debugger support.

Debug jobs on a slave

Debugging a maven job that runs on a slave works in a similar way. If port 5001 is already taken by Hudson's slave agent, then change the port to another value, e.g. 5002: "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=5002". Then connect your debugger to the IP address of your slave and the specified port (5001 or 5002).

  • No labels