Here is a guide to building a plugin using Eclipse. It looks deceptively simple, but it took me several days to figure this out, so I figure I will document it here:
Running the compiles using Maven are quite slow on my computer, so I wanted to avoid that, and I wanted to take advantage of the continuous build feature in Eclipse. However, trying to do everything without maven turned out to be fairly masochistic: some things are simplest to leave to maven. Here is a procedure that worked well for me: - use maven to create the new plugin project, or download the existing plugin project from git - use maven to create the eclipse project, ie 'mvn eclipse:eclipse' - use maven to create and install an hpl file, ie 'mvn hpi:hpl -Dhudson_home=/your/jenkins/home/here' - how, open the hpl file in a text editor, and change the first of the paths in the Libraries: entry from 'classes' to 'eclipse-classes' Ideally, remove all surplus plugins from your jenkins home, then start jenkins. Note that you can get jenkins to start really quickly: - first, remove all unnecessary plugins, and create 'blahblah.hpl.disabled' files (where 'blahblah' is the name of a plugin), in the plugins directory, for the builtin plugins - use 'jar -xf' to extract the jenkins.war file somewhere, let's call this directory $JENKINSAPP - launch jenkins by 'java -jar $JENKINSAPP/winstone.jar --webroot=$JENKINSAPP' - now, whenever you make a change, just ctrl-c out of jenkins, and restart it Lastly, we need to register the @Extensions from our plugin, which is done using the sezproz annotation processor. As of writing, we need a slightly patched version: - git clone the patched sezproz from https://github.com/hughperkins/sezpoz - cd into the sezpoz/sezpoz directory - 'mvn -DskipTests install' Now, back in your eclipse project, do 'properties' on your project, and: - select 'java compiler' - make sure compliance is set to 1.6 or higher - go to 'java compiler' | 'annotation processing' - click the three checkboxes - go to 'java compiler' | 'annotation processing' | 'factory path' - click 'add external jars...' - go into the 'target' folder of the sezpoz/sezpoz directory, and select the sezpoz SNAPSHOT jar file - click 'ok', then 'yes', then 'ok' - check that your eclipse-classes directory now contains a directory 'META-INF/annotations', and inside it is a file 'hudson.Extension' - if that file exists then you're good to go! - restart your jenkins, and verify that everything is working ok -- You received this message because you are subscribed to the Google Groups "Jenkins Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
