JSF & Java Blog

Discussion on Java and JSF, including Spring, Maven, Eclipse and Jenkins

Posts Categorized / Maven

Preventing Maven Plugin Mojo running multiple times for multi module projects

Amongst other tasks, in development we have a need occasionally to copy static content files into our web root from a network location. We decided to create a maven plugin to allow these tasks to be setup quickly on the command line (rather than having a collection of batch scripts to do this). Our maven […]


Beware what you put in the endorsed dir!

We use docflex to build our XSD documentation, integrating with maven to produce XSD documentation in our maven site reports. I recently had to upgrade some developers from docflex-re 1.8.0 to 1.8.5, this migration went fine. For some reason it didn’t on my machine. I received the following error: Anyway to cut a long story […]


Upgrading to Maven 3 Site Reporting

Whilst upgrading our build to use Maven 3 and the reporting to use the maven-site-plugin 3.0-beta-3 I used the following steps to upgrade the reporting. When I ran the build it failed With the message The plugin I was using (a version of the maven css validation plugin that I have modified to generate reports) […]


Using Maven to check facelets are valid

Although Eclipse validates our xml documents, sometimes invalid xml documents can get committed into our source repository by accident. Using the maven xml-maven-plugin we can force the build to break when xml documents aren’t welformed. Currently we are only doing the check on facelets (files with a .xhtml extension): The xml snippet below shows the […]


Top reasons to adopt Maven 3

A great article was recently posted on the Sonatype blog on the top 10 reasons to move to Maven 3 It will be interesting to see if there is a significant speed increase, as it will be nice to reduce the time of our main nightly build which usually takes about 90-95 minutes. Luckily, Hudson […]


Maven pom Checkstyle configuration with Eclipse

In a previous post on Eclipse plugins, two excellent plugins were mentioned which can automatically set up your Eclipse project to use the same Checkstyle configuration that is configured in your pom file. However, the only problem with both of these plugins is that they will only be able to find your Checkstyle configuration if […]


Maven site generation error: DTDDVFactoryImpl does not extend from DTDDVFactory

When generating a site with Maven, we encountered the following exception when a particular reporting plugin was executed: This basically meant that an incompatible version of xerces was trying to be run. We have everything set to use Java 1.6, which ships with its own version of xerces. After some debugging, it was tracked down […]


Suppress logging in java unit tests

Here are a couple of different ways of suppressing logging when running unit tests. If you are using apache commons logging then you can suppress logging with the following code: If running your unit tests with JUnit, it is probably best to put this code in the setUp() method. However, if you only wanted it […]


Cobertura code coverage with Maven and PowerMock

If you use Powermock for unit testing with Maven and Cobertura for code coverage, you are likely to be affected by the following issue noted on the PowerMock issue tracker. If you did not have the maven-surefire-plugin forkmode configured to ‘pertest’, you would find that any tests annotated with @RunWith(PowerMockRunner.class) had zero percentage code coverage […]