Tuesday, June 26, 2012

Progress! :D

I mentioned briefly in my previous post that I was working on integrating FindBugs into our Ant build. What I didn't tell you is how much time and effort has been going into figuring out how to get it to work properly! After almost 2 weeks of work, FindBugs is finally working properly in our build (writing reports to the console/xml output file and all!)!! It may sound silly to be so excited about something so small but if any of you knew EXACTLY what I (with help from Joe Rice, the leader of my development team) went through to get this to work. Let me give you a brief overview of what I have gone through to get this wonderful plug-in integrated into our Ant build.

There's a nicely published FindBugs manual that pretty much covers (if only briefly) all you need to know about the FindBugs tool/plugin, including integrating it with Ant. Newer versions of FindBugs come out of the box with an Ant task that can be used for "easier" integration -- yeah right. Chapter 6 of the manual is dedicated to explaining how to use the FindBugs Ant task. The problem is the explanation given probably works...but on simple projects with one build file (and probably not many source/class files). Me being the novice I am, I follow the directions given to a tee....ERROR. In the meantime, I'm wondering how I just followed their exact instructions and my build is failing because of it! In doing a little more browsing (and having a brief discussion with my project leader) I found that there were a "few" things that would have to change due to the nature of our project and the way the build fileS are already set up (yes I purposefully made the s on files bold and capitalized - I want to emphasize this because it wound up playing an important part in my confusion :) ). After a valiant effort, I wind up with this output:


findbugs:
     [echo] Analyze the source code with FindBugs
 [findbugs] Executing findbugs from ant task
 [findbugs] Running FindBugs...
 [findbugs] edu.umd.cs.findbugs.NoClassesFoundToAnalyzeException: No classes found to analyze in C:\workspaces\trunkNEW\ConfigurationDashboard\target\classes_robot_src C:\workspaces\trunkNEW\ConfigurationDashboard\target\classes_robot_test C:\workspaces\trunkNEW\ConfigurationDashboard\target\classes_test C:\workspaces\trunkNEW\ConfigurationDashboard\target\classes_src *C:\workspaces\trunkNEW\External\Tools\Java\jdk1.6.0_23\jre\lib\resources.jar *C:\workspaces\trunkNEW\External\Tools\Java\jdk1.6.0_23\jre\lib\rt.jar *C:\workspaces\trunkNEW\External\Tools\Java\jdk1.6.0_23\jre\lib\jsse.jar *C:\workspaces\trunkNEW\External\Tools\Java\jdk1.6.0_23\jre\lib\jce.jar *C:\workspaces\trunkNEW\External\Tools\Java\jdk1.6.0_23\jre\lib\charsets.jar *C:\workspaces\trunkNEW\External\Tools\Java\jdk1.6.0_23\jre\lib\ext\dnsns.jar *C:\workspaces\trunkNEW\External\Tools\Java\jdk1.6.0_23\jre\lib\ext\localedata.jar *C:\workspaces\trunkNEW\External\Tools\Java\jdk1.6.0_23\jre\lib\ext\sunjce_provider.jar *C:\workspaces\trunkNEW\External\Tools\Java\jdk1.6.0_23\jre\lib\ext\sunmscapi.jar *C:\workspaces\trunkNEW\External\Tools\Java\jdk1.6.0_23\jre\lib\ext\sunpkcs11.jar *C:\Dev Tools\FindBugs\findbugs-2.0.1-rc2\lib\annotations.jar *C:\Dev Tools\FindBugs\findbugs-2.0.1-rc2\lib\jsr305.jar
 [findbugs] at edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:274)
 [findbugs] at edu.umd.cs.findbugs.FindBugs.runMain(FindBugs.java:369)
 [findbugs] at edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:1300)
 [findbugs] Java Result: 4

Now, I'm not a big stack trace person so this really isn't telling me much of anything besides that FindBugs hates me. I decided the best first step would be to figure out why it's not finding the classes I specified for it to analyze (the top 4 paths). After more investigating, I found out that I wasn't following the right conventions to feed the path into the xml document. The way the build files were setup all the paths were defined and I wrote it incorrectly. It also didn't help that I was rusty on xml (it's been a couple years). After a while, I was able to make more progress...but then uh-ohhh...


findbugs:
     [echo] Analyze the source code with FindBugs
 [findbugs] Executing findbugs from ant task
 [findbugs] Running FindBugs...
 [findbugs] edu.umd.cs.findbugs.NoClassesFoundToAnalyzeException: No classes found to analyze in *C:\workspaces\trunkNEW\External\Tools\Java\jdk1.6.0_23\jre\lib\resources.jar *C:\workspaces\trunkNEW\External\Tools\Java\jdk1.6.0_23\jre\lib\rt.jar *C:\workspaces\trunkNEW\External\Tools\Java\jdk1.6.0_23\jre\lib\jsse.jar *C:\workspaces\trunkNEW\External\Tools\Java\jdk1.6.0_23\jre\lib\jce.jar *C:\workspaces\trunkNEW\External\Tools\Java\jdk1.6.0_23\jre\lib\charsets.jar *C:\workspaces\trunkNEW\External\Tools\Java\jdk1.6.0_23\jre\lib\ext\dnsns.jar *C:\workspaces\trunkNEW\External\Tools\Java\jdk1.6.0_23\jre\lib\ext\localedata.jar *C:\workspaces\trunkNEW\External\Tools\Java\jdk1.6.0_23\jre\lib\ext\sunjce_provider.jar *C:\workspaces\trunkNEW\External\Tools\Java\jdk1.6.0_23\jre\lib\ext\sunmscapi.jar *C:\workspaces\trunkNEW\External\Tools\Java\jdk1.6.0_23\jre\lib\ext\sunpkcs11.jar
*C:\Dev Tools\FindBugs\findbugs-2.0.1-rc2\lib\annotations.jar
*C:\Dev Tools\FindBugs\findbugs-2.0.1-rc2\lib\jsr305.jar
 [findbugs] at edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:274)
 [findbugs] at edu.umd.cs.findbugs.FindBugs.runMain(FindBugs.java:369)
 [findbugs] at edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:1300)
 [findbugs] Java Result: 4



Now I gotta figure out what this is about...why is it not finding classes in these paths?..Are they actually not there? Do I have my jar files in the wrong folders? Are some of my paths whacky that I've added/included? So many questions....so few answers. On top of all that, it was doing weird things....I would add a path to my auxClasspath thinking it would take one things away from the list and it would end up taking away something completely different. Finally, I got to the point where nothing was changing and if it did it was changing in the wrong direction. I flagged down my project leader and he decided to make an appointment on our calendars to meet for a couple hours to sit and look at what I've done and hopefully figure out what I've done wrong. After sitting down and staring at the xml for a while, we were able to make some changes that took progress is the RIGHT direction! A lot of it was manual and tedious, but at the end of the day (literally) we were able to get everything running smoothly on all projects!


Now, does anyone want to know the best part?? I'm still not done!! :) - next step, integration into our continuous integration tool, Jenkins! I'll keep updating with the juicy details! :D

Jusqu'à la prochaine fois [[Until next time in French :D ]]...

No comments:

Post a Comment