Friday, January 19, 2007

Software Update:
Couple of new releases to note:
Cruisecontrol 2.6
PMD 3.9
Findbugs 1.1.3

Wednesday, December 20, 2006

ant-contrib 1.0b3 is out!

ant-contrib 1.0b3, a broadly used helper library for Ant, was released in October. This release adds some new tasks. Check out their read-me for more.

Ant 1.7 is out!

The folks over at Apache have released Ant 1.7. It's the first major release in almost 18 months. Head on over to http://ant.apache.org to check it out.

Wednesday, December 06, 2006

The wonders of XSLT 2.0

In our current Ant build setup, we parse a lot of the source analysis xml reports to gather figures on code bugs,coverage, etc and compile them into a single report. This is currently achieved by means of a combination of grep,gawk,sed, and the math function of the ant-contrib library. It's cross-platform and it's horrendously messy.
Enter XSLT 2.0
I had dabbled with XSLT 1.0 to tweak our PMD reports to show violations other than priorities 1-5, and had only just managed to gain enough knowledge to do that and only that.
However, I thought I could improve upon the standard HTML PMD report template, so I recently bought Michael Kays XSLT 2.0 and XPath 2.0 books. Both serve as excellent reference material to the two language standards.
Working with XSLT, you need a good XSLT 2.0 debugger/editor, so I purchased a copy of Syncrosoft's oXygen 8.0 XML Editor. This has excellent support for XSLT debugging, and is compliant with latest XSLT 2.0 standard (June 2006), which is achieved through its use of Michael Kays (author of the books) Saxon XSLT/XPath library.
Saxon is also available as a free download from http://saxon.sourceforge.net

I'm now beginning a project to remove all of the sed/awk/grep nonsense from the ant-script and replace it with some tidy XSLT.
If you have to pull data from xml reports for code stats, and aren't using XSLT, then you should check it out. Those of you using XSLT 1.0 to generate HTML reports from xml data would do well to see what benefits you could achieve by moving to XSLT 2.0 + XPath 2.0

I'll post a link to a sample PMD report generated with XSLT 2.0 from PMD XML data sometime soon.

Wednesday, August 16, 2006

New book on Ant Development with Clearcase and Cruisecontrol

Kevin Lee has just published a new book dealing with setting up continuous integration environments around ant, clearcase and cruisecontrol.
I got myself and copy and it' s pretty damn good.
Head over to Amazon.co.uk and check it out:
http://www.amazon.co.uk/gp/product/0321356993/026-0856102-7273207?v=glance&n=266239
I'll be posting more posts in the next while, as I'm beginning to teach myself java development....;-D

Tuesday, May 09, 2006

Code Coverage Tools

A recent problem arose at work where our code coverage tool, Cobertura ceased to work for a particular application. Well actually, "ceased" is the wrong word. It didn't work from the get-go. We had however, been using Cobertura succesfully with other apps. We discovered that the problem was due this particular app already having it's bytecode instrumented by a tool called Versant Enhancer. So we had both Versant Enhancer and Cobertura trying to instrument the same bytecode with the result that either the code didn't work, or we got no coverage figures, or both.
So what to do? We like Cobertura but we can't use it on this app unless Cobertura or Versant engages in a major re-write for our sake. Which isn't gonna happen.
Another coverage tool is Emma, but that too instruments the bytecode, ruling it out.
We also have access to PureCoverage* but found it to be too unstable in our Java development environment (haven't tried it with C) to be useful.
Finally a viable alternative to Cobertura emerged.
Clover is a commercial coverage tool that instruments the sourcecode, thereby preventing our problem with Versant. We're about to start trials to make sure this is the case, and I'll post the results in a few weeks.
To sum up:
ByteCode Instrumentation Coverage Tools:
Cobertura
EMMA

SourceCode Instrumentation Tools:
Clover

You can check Cobertura out here:
http://cobertura.sourceforge.net/
You can check EMMA out here:
http://emma.sourceforge.net/
You can check Clover out here:
http://www.cenqua.com/clover/

*PureCoverage is available only as part of Rational PurifyPlus. I've included a link to that product in the sidebar.

Findbugs

While we use PMD at work for our static code analysis, much has been made of late of FindBugs, a similar tool to PMD developed by the University of Maryland. Many reviews of both PMD and FindBugs suggest using them to complement one another.
Find out more about this tool here:
http://findbugs.sourceforge.net/

Using Ant behind a proxy server

A problem recently cropped up with my build that was caused by the xerces xml parser trying to validate an xml using the dtd reference in the file. The problem was that the dtd was stored on the web. The web in turn, was only accesible through our corporate http-proxy server, which neither Ant nor the JVM knew anything about.
After some searching I discovered there's an Ant task called "setproxy" that allows you to inform Ant of your proxy setup, so anything else run in the same JVM has access to the web.
You can find out how to use the "setproxy" task here:
http://ant.apache.org/manual/OptionalTasks/setproxy.html

Monday, May 08, 2006

Groovy: A new language for the JVM













I could try and explain what Groovy is myself, but it's best to quote from this website:

"Groovy. No, this isn't a review of the latest Austin Powers movie. Instead, it is about an evolving new language for the Java 2 platform. Yes, new language. The Java platform is that, a platform, not just a programming language. What Sun Microsystems provides is a complete platform: a programming language, a core set of libraries, and a runtime environment, where the last bit is also known as the Java virtual machine
1 or JVM. The instruction set of the JVM is a set of operational codes or opcodes as defined by the Java Virtual Machine Specification. The virtual machine doesn't care what programming language those opcodes started as, as long as what the JVM sees is the appropriate opcodes. And, that's where Groovy comes in. Through JSR 241, the Java Community Process is helping to standardize a new language for the Java platform. According to Richard Monson-Haefel, a Sr. Analyst of Burton Group and former specification leader, "The Java programming language is excellent for large complex systems, but it can be overkill when it comes to small jobs." And, that's what Groovy offers, a scripting language that runs natively on the JVM and works with Java objects, APIs, and tools.

According to James Strachan, expert group lead and Groovy co-founder (with Bob McWhirter), Groovy started with a desire for "an alternative to javac, which had the power and expressiveness of Ruby/Python but generated regular Java classes (at runtime or build time) and that worked directly with Java classes without some other layer. So I wanted a Groovy object to descend from java.lang.Object, with collections being java.util.Collection, lists being java.util.List, support for Java arrays, Java beans, and for all the APIs in the system to be based on Java 2 Platform, Standard Edition (J2SE) and Java 2 Platform, Enterprise Edition (J2EE)."

So there you have it. But why include information on Groovy in a Java test-tool blog? Well, most of the compilation/testing tools now offer support for Groovy. Ant and Cobertura are just 2 of the tools offering support.
Again, I haven't had time to look into detail, but said I'd put the information out there.
You can grab Groovy here:
http://groovy.codehaus.org/

Continuous Integration: Update

One of the most well known articles on the "continuous integration" aspect of Extreme Programming has recently been revised and brought up to date.
Click here:
http://www.martinfowler.com/articles/continuousIntegration.html

Thursday, May 04, 2006

JUnit for beginners

If you're beginning to write JUnit tests, but haven't fully got your head around the whole unit-testing "thing", then a visit to the following site will probably prove useful:
http://www.clarkware.com/articles/JUnitPrimer.html
It's pretty basic, but should get you up and running.

CruiseControl & Useful Information

I'm currently evaluating (part-time) a number of different options for build automation. Maven+Continuum is a nice neat package, but (from initial inspection), not as flexible as Ant+Cruisecontrol+Ivy.
As I haven't posted much in the way of information on Cruisecontrol, I thought I would at least offer the following tip.
  • DON'T WASTE TIME LOOKING FOR USEFUL INFORMATION AT THE CRUISECONTROL WEBSITE.
There isn't a lot. If you want the lowdown on everything to do with CruiseControl head to:
http://confluence.public.thoughtworks.org/display/CC/Home

Its a wiki, fully endorsed by the developers of CruiseControl, that expands upon everything available at the official CruiseControl home, and adds a whole lot more. It should be everyone's first stop for all things CruiseControl.
If you feel like punishing yourself of course, head over to:
http://cruisecontrol.sourceforge.net/
and look for documentation....;-D

Ant in Anger: Using Apache Ant in a Production Development System

The following article "Ant in Anger" is an excellent guide to using Ant effectively in a production environment. As well as detailing best practices, it also lets the reader know what some of Ant's shortcomings are and how to work around them. It's included as part of every Ant distribution, but can be hard to find. You can find the article here:
http://ant.apache.org/ant_in_anger.html

And yes, I know it's more than a year old, but it has been updated since the last major release of Ant (1.6 at the time of this post. I consider 1.6.1-5 minor releases.), and the information contained within is still perfectly relevant at the time of this post.