Posts tagged ·



Getting started with Jenkins plugin development

Comments Off

Getting started with Jenkins plugin development is surprisingly easy. There is neat integration with Maven for building and testing a debug instance, and the build artifact can quickly be installed to an existing Jenkins instance.

Dev dependencies

Setting up the developer environment on a new system can be done through the following apt-get. However, on an older Debian (e.g. 8) or Ubuntu (~16 or older), you’d want to download Java JDK; Eclipse and Maven from their respective homes.

apt-get install openjdk-8-jdk eclipse-jdt maven

Starting from an existing plugin

Starting from an existing plugin is probably most straight forward, since a lot of the details are usually already in place. The “Test Results Analyzer Plugin” serves as a nice stand-alone example.

git clone
cd test-results-analyzer-plugin

To create an Eclipse workspace which later can be opened as an existing project in Eclipse:

mvn -DdownloadSources=true -DoutputDirectory=target/eclipse-classes -Declipse.workspace=~/test-results-analyzer-plugin eclipse:eclipse eclipse:configure-workspace

To build the .hpi file which can be installed through Jenkins:

mvn hpi:hpi

For development and debugging, to create and launch a new Jenkins instance, which will have the new plugin installed.

mvn hpi:run

New plugin

Or, if you’d rather start from a clean plate, the following will create the skeleton structure.

mkdir foobar; cd foobar
mvn -U

Once created, the commands above also apply, but you probably want to dive into the pom.xml file first, and define project information, dependencies.


For further details, see:

Comments Off

Java 8: File handling becomes fun

Comments Off

With the introduction of functional-style syntax and several new Stream based methods in Java 8, file handling finally becomes fun and easy. In fact, the new helper methods and lambda syntax even gives Python a run for its money when it comes to compact code.

Here is how you could read all lines of a file, given as a Path p (since Java 7), and output to stdout.


To make it a bit more clear what is going on, here a bit more is included and broken up.

Path p = Paths.get("myfile");
Stream lines = Files.lines(p);

A similarly neat helper function exists for recursively walking over the directory tree of the file system. Again, this prints to stdout.


Comments Off

Java 7 Released

1 comment

Oracle (finally) released Java 7 today, 4 years and 7 months after the initial release of Java 6. The previous version updates used to be on a 18 months schedule, so that makes this release 37 months late. It’s getting a pretty good bashing on Slashdot, primarily for its current owner, Oracle.

New features includes syntactic sugar like Strings in switch statements; underscores in numeric literals; and type inference for generic instance creation. The Open JDK site lists the same features, so I’m guessing that means everything is open sourced already. However, it seems smaller items on my wish-list did not make it, like the Immutable annotation. (The JSR 305 has been inactive for ages, and still the only implementation is a Google Code hosted project.)

The new Java Doc is here, and latest download from Oracle here. The Open JDK binaries are also available in the repositories of major distributions.

yum install java-1.7.0-openjdk java-1.7.0-openjdk-devel

sudo apt-get install openjdk-7-jre openjdk-7-jdk