Tag Archives: hudson

Grails & Hudson / Jenkins Part 6: Sonar

Sonar is an open source code quality management tool – this requested addition to the Grails & Hudson / Jenkins series gives a quick run through of how to set up Sonar to analyse Grails code from a Jenkins job.

Continue reading

Grails & Hudson / Jenkins Part 5: Monitoring build status

There are a number of ways you can monitor the progress of your Grails build: using the Hudson / Jenkins web app; or leveraging the API: from your IDE, bespoke API clients or even your enterprise monitoring client. We’ll look at all of them here and build a simple Grails taglib to display build status in the ‘Application Status’ panel.
Continue reading

Grails & Hudson Part 4: Automated Deployment

This is a quick post to describe the steps involved with getting Hudson to deploy a Grails application to a remote Tomcat server.
Continue reading

Grails & Hudson talk at London GGUG

I’ll be presenting Grails & Hudson at the October meet-up of the London Groovy & Grails User Group. The proposal for this talk actually inspired the Grails & Hudson series on this blog – so come along as you may get a sneak preview of some of the content for upcoming posts in the series!

More details here on meetup.com.

The event is kindly hosted by SkillsMatter.

Update: new registration link for the event with SkillsMatter: http://skillsmatter.com/event/java-jee/advanced-grails-ci-testing-stats-deployment-with-hudson/rl-390

Update: If you missed it you can see the podcast.

Grails & Hudson Part 3: Testing

Since Grails incorporated the testing plugin into core it provides good unit & integration testing support (via the test-app script). There are also additional plugins to support BDD tools (e.g. EasyB) and functional testing (e.g. Canoo WebTest).
One of the useful roles that Hudson fulfils is helping to manage quality. Consequently it has plugins available for most of the popular testing tools (we saw an example of the Violations plugin in part 1 of this series).
We’ll start with the standard unit & integration tests, then add in test coverage and functional tests.
Continue reading

Hudson quick tips: Build time trend

Hudson tells you how long your build has taken and, being Hudson, helpfully tracks this information in a trend graph.

This is accessible from the “(trend)” link on the Build history panel for a job or by clicking on the time from a specific build.
Continue reading

Grails & Hudson Part 2: Back to basics

Ok, so you’ve decided that you want to use Hudson to build your Grails projects (or have read part 1 and want to use CodeNarc too).
If you don’t know where to start, you’ve come to the right place.

The basic steps (and we’ll go into more detail on each one) are:
1. Download Hudson
2. Run Hudson
3. Download Hudson plugins
4. Configure Hudson
5. Create a Hudson job
6. Watch the trends
Continue reading

Grails & Hudson part 1: CodeNarc

Grails has a rich plugin eco-system with over 400 hundred plugins – so it’s easy to miss something useful. If you’re serious about software craftsmanship, then using static code analysis tools should be part of your quality regime as it gives further insight into the code base (and if you insist, yes it’ll help with your Technical Debt management).

CodeNarc provides static code analysis for Groovy and the CodeNarc plugin for Grails allows you to perform this analysis with the “grails codenarc” script. Behind the scenes this uses the CodeNarc ant task and settings from grails-app/conf/Config.groovy and produces an HTML report by default.

Until recently, if you used the codenarc target within a continuous integration server such as Hudson – then the HTML report would be generated and sit in the workspace waiting for a diligent developer to check it. You can imagine how often that happens in practice with all the other demands of a project!

However, I’ve now integrated the CodeNarc XML output with the Hudson Violations plugin so that an overview trend line is shown against the Hudson job. Then the team quickly fixed the violations…

You can also get a breakdown by priority:

And in-context views of the violations so you know what to fix:

This is how you do it…

Grails config.groovy

codenarc {
 reportName = 'target/test-reports/CodeNarcReport.xml'
 reportType = 'xml'
 // any further settings like maxPriority1Violations=0
}

Hudson

Set up your Grails build step – normally you’d add the ‘codenarc’ target:

The codenarc.properties file can be used to configure specific exclusions, the location of this file can be passed in as a system property (shown above).

You need to have version 0.7.7 (or later) of the violations plugin installed (Manage Hudson > Manage Plugins > Available and search for Violations).
As this is a recent addition, I’m using a patched version of the Violations plugin, though the patch has been integrated into trunk (I’ll update when it is released).
Configure violations:

Note the ‘Faux project path’ – you may need to set this to get an in-context view working properly due to path (e.g. if your code is checked out to workspace/trunk)

I also had a contribution to CodeNarc accepted at the weekend to add an inlineXml report type – this will, with a minor tweak to the CodeNarc parser, allow the Hudson Violations plugin to give the rule description on the pop-up message.

[image here]