I’ve spent the better part of Friday and today tracking down why my builds which had FindBugs running in them were failing. I eventually got that yak shaved, and now they are working again. This post is so I can refer back to something if (when) I encounter something similar again.

Environment
We are using Maven as our build platform, partially due to the ease of integrating cool stuff like FindBugs though plugins like the maven-findbugs-plugin. Our builds are actually produced by Hudson, where I have a build which triggers the various static analysis tools on a nightly schedule to keep the main build as fast as possible. Those builds use the Hudson’s FindBugs plugin to display a nice little graph of the number of bugs and type.

Oh, and as I’ll explain, we’re also using Nexus to host our own Maven repository and proxy all other repositories

Problem
For some reason the builds started failing a week or so ago with the following showing up in the log

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to configure plugin parameters for: org.codehaus.mojo:findbugs-maven-plugin:2.1-SNAPSHOT

Cause: Cannot find setter nor field in org.codehaus.mojo.findbugs.FindBugsMojo for 'findbugsXmlWithMessages'

In hindsight I should have picked up on the bit that said it is using version 2.1-SNAPSHOT of the plugin since I have 2.0.1 configured. But didn’t. And so went crawling through code and changelogs, etc. to no avail. It wasn’t until the maintainer of the Hudson FindBugs plugin pointed out not using the snapshot that I started down the path to success.

Solution
As I mentioned, we’re proxying all Maven requests through the a private repo running Nexus. It would appear that when it needs a jar, it does a search on it by name (‘findbugs’) in that server and if that name exists in multiple proxied repos you can find yourself getting the newest version. Even if you have specified a specific version. Such is the case with the FindBugs jar which exists both in Codehaus and Central which are the two main Maven repos out there.

The actual solution involves ‘routing’ in Nexus terminology. By making an ‘inclusive’ route on the pattern .*/maven-findbugs-plugin/.* and choosing only Central, the build started to get the correct version of the plugin and stopped failing.

Moral
Once again, I had to be reminded of something I have written about before. And that is to really understand how all the tools in your build chain work.