Automatic Version Numbering in Web Applications with Hudson (Add-On)

In the 3 parts of the tutorial (part 1, part 2, part3) we setup a Netbeans/Web-Project/Hudson/ZK environment that creates and reads automatically version numbers. Unfortunately while building outside HUDSON, or better with your local Netbeans IDE, ANT can’t read the HUDSON variables, resulting in a Manifest like this:

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.1
Created-By: 14.2-b01 (Sun Microsystems Inc.)
builduser: sven
version: ${env.BUILD_VERSION}
id: ${env.BUILD_ID}
tag: ${env.BUILD_TAG}
server: ${env.BUILD_URL}

And potentially the website will display ${env.BUILD_VERSION} as version. Not very professional. Of course a local build should not find its way to production system, but at least it should state it properly.

Continue reading

Tutorial: Most simple Test Application for Embedded Glassfish + Netbeans + Hudson

With Glassfish V3 (or better with Java EE6 and EJB 3.1) it becomes way easier to test EJB’s, which is now possible to do with the embedded Glassfish. Lets have a quick and very basic walk-through and highlights some of the current issues and pitfalls.


  • Netbeans 6.8
  • Glassfish V3
  • optional: a Hudson installation (at a remote server) with a local Glassfish V3 installation


  • Create a new Web Application WebTestEmb
    Standard EE6 project with a local or remote GF, no frameworks
    Activate local lib-folder and use dedicated lib folder for server libraries !

    New Web Application

    Continue reading

Tutorial: Getting started with Netbeans and JUnit plus Cobertura (Part 1)

I believe strongly in testing. I saw companies and products without any automatic test frameworks and the slightest change to the codebase (often in the urgent ‘we-need-to-fix-it-now-and-give-to-the-customer-in-1hr’ mode) made parts of the product or modules prone to crashes because no one could test the changes against the complete application. In my current endevour to create a new product we embrace testing, though we dont practice TDD (test-driven-development), but at least we maximize the amount of automatic testing with tools/frameworks like Netbeans, Hudson, Cobertura and others. If you dont practice TDD, how can you judge how much of your codebase is really tested, even you assume all you business testcases are covered ?

The other day Code Coverage crossed my way (Thanks Chris!). Eager to find out how to “do it” or to “use it” I found a few tools suitable for the Netbeans environment. It actually drilled down to only one tool: Cobertura. It fits exactly into our landscape using Netbeans and Hudson and it is opensource.
To get started with Cobertura you should be familiar (a bit) with Netbeans, JUnit and Ant. The Cobertura website offers sufficient reference for all functions and introduction to get you started. But what I missed is a tutorial the start from the scratch using Netbeans and Cobertura. I found 3 references (I will add them at the end,) which are not complete or just not working for me), so let me share the most basic getting-started steps with you.
Please note: This is how I get started, it might not be complete, foolproof or even correct in all details. Please feel free to comment, correct or give other feedback !

Continue reading