2012-01-29

Working with Java 7 and Maven quality assurance plugins (Code coverage, Checkstyle, Findbugs and PMD) on Sonar

At present, only the default maven-findbugs-plugin will work on Java 7. But with a little tweaking, we can get all the rest of the widely used maven quality assurance(QA) plugins working!

The only open source and free code coverage tool working on Java 7, is named JaCoCo.

In the pom file below, i have set all the QA plugins to the maven phase "pre-site" and will work with Sonar.
To run all the maven QA plugins at ones, use the command:
mvn clean install pre-site

Glassfish 3.1 with Jackrabbit


This article will describe how to add the Jackrabbit content repository (JSR JSR 170 and 283) to Glassfish 3.1.

Download the following packages:
·         jcr-2.0.jar
·         jackrabbit-jca-2.2.4.rar

Follow the steps to install Jackrabbit:
1.       Copy jcr-2.0.jar to $GLASSFISH/lib
2.       Start Glassfish
3.       In the glassfish admin-console go to "Configuration/server-config/Thread Pools". Add a new Thread Pool called "jackrabbit-pool" and leave all parameters untouched
4.       In the glassfish admin-console go to "Applications" Click the button "Deploy" and browse to the jackrabbit-jca-2.2.4.rar file.
5.       In the glassfish admin-console go to "Resources/Connector/Connector Connection Pools Add a new Connection Pool called "jackrabbit-connection-pool" and select the Resource Adapter called "jackrabbit-jca-2.2.4". Scroll to the bottom of the page and add:
a.       configFilePath="full path to repository.xml"
b.      repHomeDir="full path to the repository home folder"
6.       In the glassfish admin-console go to "Resources/Connector/Connector Resources". Add a new Resource with the JNDI Name "jcr/repository". Select the "jackrabbit-connection-pool" as Pool Name and click the OK button.
7.       Restart your application server (because of the newly created thread-pool).

Now is the repository available via JNDI and can be injected with the @Resource annotation.

@Resource(mappedName="jcr/repository", type=javax.jcr.Repository.class)
private Repository rep;