Today I was fixing the build-publisher plugin that is broken when a matrix configuration changes. So, I git cloned the plugin, installed maven (not maven2), and ran mvn package.

Compilation went fine then come the tests … FAIL!

Hm, it failed right at the start during test injection with the following trace:

-------------------------------------------------------------------------------
Test set: InjectedTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.218 sec <<< FAILURE!
initializationError(InjectedTest) Time elapsed: 0.005 sec <<< ERROR!
java.lang.UnsatisfiedLinkError: com.sun.jna.Native.open(Ljava/lang/String;)J
at com.sun.jna.Native.open(Native Method)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:236)
at com.sun.jna.Library$Handler.(Library.java:140)
at com.sun.jna.Native.loadLibrary(Native.java:366)
at com.sun.jna.Native.loadLibrary(Native.java:351)
[...]

Not good.

What is that, missing environment variable, broken path, jdk7 on quantal, wrong library ???

After digging a bit around which jna lib was installed on my system, I decided to uninstall libjna-java and all the jenkins stack since it is a dependency of jenkins-common.

Bingo! mvn test passed.

Now, that’s a problem because it’d mean I cannot run jenkins and build jenkins plugin on the same system :/ Hopefully jna is in the maven repository, and we can tell him to use it instead of the version installed on the system. Just add the following to your pom.xml file:

<dependency>
    <groupId>net.java.dev.jna</groupId>
    <artifactId>jna</artifactId>
    <version>3.2.2</version>
</dependency>

If you want to use the latest version 3.4.0, run maven with the following option:

$ mvn -DargLine="-Djna.nosys=true" test

And that’s it, jenkins and the pluging development environment running hand in hand on Ubuntu Quantal! :)

I filed launchpad bug 1065253 to track this issue.