JSF & Java Blog

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

Posts Categorized / Web

Newer jQuery with Richfaces

Richfaces 3.3 comes with jQuery 1.3.2 and so you may find you want to use some newer features of jQuery that are only available in a later version. It is actually very easy to use a newer version of jQuery with Richfaces by simply including the newer version and then putting it into noConflict mode and assigning it to a new variable. You can then use the newer jQuery version by referring to …

0

Guava ImmutableMap Spring bean

I previously had some maps defined as Spring beans in my applicationContext.xml file. An example of a basic Map is shown below:

I wanted to make these all immutable and so Guava’s ImmutableMap seeemed the logical Map type to use. However, ImmutableMap is abstract so you can’t just do the following:

Instead, thanks to help from Paul Reeves, …

0

Spring MVC 406 status code from AJAX requests

Recently after upgrading from Spring MVC 3.1.2.RELEASE to 3.2.0.RELEASE, all of our AJAX requests stopped working, and instead returned a 406 status code ( see here for status code meanings ). We were using Jackson 2.1.2, the following snippet from the pom.xml file shows the two dependencies:

com.fasterxml.jackson.core

jackson-core

2.1.2

com.fasterxml.jackson.core …

0

Using Reflection to print out an object

This is really old news but I always forget which class to use when I need to provide a toString method that uses reflection to print out all the classes values

ToStringBuilder.reflectionToString in the apache commons library gives this functionality.

e.g.

@Override

public String toString() {

return ToStringBuilder.reflectionToString(this);

}

We are currently starting to …

0

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 project is a multi module project with a layout similar to this:

parent

web …

0

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:

java.lang.NoClassDefFoundError: org/apache/xml/resolver/CatalogManager

Anyway …

0

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

Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.0-beta-3:site

(default-site) on project webapp: failed to get Reports: Could not find goal

'index' in plugin …

1

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 configuration of the plugin for …

0

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 / Jenkins makes it easy to test out running builds using different versions of Maven, so there is …

0
Pages:123