<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>JSF Blog</title>
	<atom:link href="http://www.jsfblog.info/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jsfblog.info</link>
	<description>Discussion on all things Java and JSF</description>
	<lastBuildDate>Wed, 25 Apr 2012 17:46:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Using Reflection to print out an object</title>
		<link>http://www.jsfblog.info/2012/02/using-reflection-to-print-out-an-object/</link>
		<comments>http://www.jsfblog.info/2012/02/using-reflection-to-print-out-an-object/#comments</comments>
		<pubDate>Tue, 14 Feb 2012 15:23:36 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.jsfblog.info/?p=485</guid>
		<description><![CDATA[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. We are currently starting to use Guava as a Utility library and the class [...]]]></description>
			<content:encoded><![CDATA[<p>This is really old news but <em>I always forget</em> which class to use when I need to provide a toString method that uses reflection to print out all the classes values</p>
<p><a title="ToStringBuilder" href="http://commons.apache.org/lang/api-2.6/org/apache/commons/lang/builder/ToStringBuilder.html">ToStringBuilder.reflectionToString</a> in the apache commons library gives this functionality.</p>
<p>e.g.</p>
<pre class="brush: java; title: ; notranslate">

@Override
public String toString() {
    return ToStringBuilder.reflectionToString(this);
}
</pre>
<p>We are currently starting to use <a title="google guava" href="http://code.google.com/p/guava-libraries/">Guava</a> as a Utility library and the class <a title="ToStringHelper" href="http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/base/Objects.ToStringHelper.html">Objects.ToStringHelper</a> provides nice utilities for printing out an objects values but unfortunately doesn&#8217;t support reflection yet. The support for reflection is discussed <a href="http://code.google.com/p/guava-libraries/issues/detail?id=422">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jsfblog.info/2012/02/using-reflection-to-print-out-an-object/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Preventing Maven Plugin Mojo running multiple times for multi module projects</title>
		<link>http://www.jsfblog.info/2012/01/preventing-maven-plugin-mojo-running-multiple-times-for-multi-module-projects/</link>
		<comments>http://www.jsfblog.info/2012/01/preventing-maven-plugin-mojo-running-multiple-times-for-multi-module-projects/#comments</comments>
		<pubDate>Tue, 31 Jan 2012 11:33:27 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[Maven]]></category>
		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://www.jsfblog.info/?p=455</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>Amongst other tasks, in development we have a need occasionally to copy static content files into our web root from a network location.</p>
<p>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).</p>
<p>Our maven project is a multi module project with a layout similar to this:</p>
<ul>
<li>parent
<ul>
<li>web
<ul>
<li>core</li>
<li>producta</li>
<li>productb</li>
<li>webapp</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>The plugin was included in the parent pom, so that the environment setup commands could be easily excused from the parent folder.</p>
<p>However, the task was running multiple times. In fact, on closer inspection it was running 6 times which is exactly how many modules we have in our project.</p>
<p>A quick read of the <a title="Maven Mojo api" href="http://maven.apache.org/developers/mojo-api-specification.html">Mojo API Specification</a> pointed me to the javadoc annotation<em><strong> @requiresProject</strong></em>, setting this value to false (the default is true) prevents the goal being run for each module.</p>
<pre class="brush: java; title: ; notranslate">
/**
 * &lt;p&gt;
 * Description of MOJO.
 * &lt;/p&gt;
 *
 * @goal some-goalname
 * @requiresProject false
 *
 */
public class MyMojoThatDoesntRunManyTimes extends AbstractMojo
....
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.jsfblog.info/2012/01/preventing-maven-plugin-mojo-running-multiple-times-for-multi-module-projects/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Beware what you put in the endorsed dir!</title>
		<link>http://www.jsfblog.info/2012/01/beware-what-you-put-in-the-endoresed-dir/</link>
		<comments>http://www.jsfblog.info/2012/01/beware-what-you-put-in-the-endoresed-dir/#comments</comments>
		<pubDate>Thu, 12 Jan 2012 11:39:37 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[xerces]]></category>
		<category><![CDATA[XSD]]></category>

		<guid isPermaLink="false">http://www.jsfblog.info/?p=445</guid>
		<description><![CDATA[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&#8217;t on my machine. I received the following error: Anyway to cut a long story [...]]]></description>
			<content:encoded><![CDATA[<p>We use <a title="docflex" href="http://www.filigris.com/products/docflex/">docflex</a> to build our XSD documentation, <a href="http://www.filigris.com/products/docflex_xml/integrations/maven/">integrating with maven</a> to produce XSD documentation in our <a href="http://maven.apache.org/plugins/maven-site-plugin/">maven site reports</a>.</p>
<p>I recently had to upgrade some developers from docflex-re 1.8.0 to 1.8.5, this migration went fine.</p>
<p>For some reason it didn&#8217;t on my machine.</p>
<p>I received the following error:</p>
<pre class="brush: plain; title: ; notranslate">
java.lang.NoClassDefFoundError: org/apache/xml/resolver/CatalogManager
</pre>
<p>Anyway to cut a long story short it transpired that about a year ago whilst working on another project I had changed the jdk&#8217;s xerces jar by placing</p>
<ul>
<li>xalan.jar</li>
<li>xercesImpl.jar</li>
<li>xml-apis.jar</li>
<li>serializer.jar</li>
</ul>
<p>in the jre/lib/endorsed directory and completely forgot about it.</p>
<p>Removing these jars (which were probably older versions and I didn&#8217;t need in there anyway) and everything works fine.</p>
<p>I&#8217;d imagine putting a new version of xerces in endorsed would probably fix this as well&#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jsfblog.info/2012/01/beware-what-you-put-in-the-endoresed-dir/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrading to Maven 3 Site Reporting</title>
		<link>http://www.jsfblog.info/2011/03/upgrading-to-maven-3-site-reporting/</link>
		<comments>http://www.jsfblog.info/2011/03/upgrading-to-maven-3-site-reporting/#comments</comments>
		<pubDate>Fri, 04 Mar 2011 17:08:38 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[Maven]]></category>
		<category><![CDATA[maven 3]]></category>
		<category><![CDATA[pom]]></category>

		<guid isPermaLink="false">http://www.jsfblog.info/?p=416</guid>
		<description><![CDATA[Whilst upgrading our build to use maven 3.0.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) [...]]]></description>
			<content:encoded><![CDATA[<p>Whilst upgrading our build to use maven 3.0.3 and the reporting to use the <a href="https://cwiki.apache.org/MAVEN/maven-3x-and-site-plugin.html">maven-site-plugin</a> 3.0-beta-3 I used the <a href="http://www.wakaleo.com/blog/292-site-generation-in-maven-3">following steps </a>to upgrade the reporting.</p>
<p>When I ran the build it failed</p>
<p>With the message</p>
<pre class="brush: plain; title: ; notranslate">

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 org.jvnet.mcvp:maven-css-validator-plugin:1.0.0-SNAPSHOT
among available goals report, validate -&gt; [Help 1]
</pre>
<p>The plugin I was using (a version of the <a href="http://confluence.highsource.org/display/MCVP/User+Guide">maven css validation plugin</a> that I have modified to generate reports) was defined in the maven 3 build as follows</p>
<pre class="brush: xml; title: ; notranslate">
....
&lt;plugin&gt;
    &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
    &lt;artifactId&gt;maven-site-plugin&lt;/artifactId&gt;
    &lt;version&gt;3.0-beta-3&lt;/version&gt;
    &lt;configuration&gt;
        &lt;reportPlugins&gt;
         ....
            &lt;plugin&gt;
                &lt;groupId&gt;org.jvnet.mcvp&lt;/groupId&gt;
                &lt;artifactId&gt;maven-css-validator-plugin&lt;/artifactId&gt;
                &lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;
            &lt;/plugin&gt;
         .....
        &lt;/reportPlugins&gt;
   &lt;/configuration&gt;
    ....
&lt;/plugin&gt;
</pre>
<p>When the plugin was configured under maven 2 (using the legacy reporting i.e. being in a &lt;reporting&gt; tag) it ran fine.</p>
<h3>The fix</h3>
<p>The last part of the exception states: <em>among available goals report, validate</em></p>
<p>The &#8220;report&#8221; goal creates the report therefore modifiynig the pom so it specifies the &#8220;report&#8221; goal in a report set seems to work.</p>
<pre class="brush: xml; title: ; notranslate">
....
&lt;plugin&gt;
    &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
    &lt;artifactId&gt;maven-site-plugin&lt;/artifactId&gt;
    &lt;version&gt;3.0-beta-3&lt;/version&gt;
    &lt;configuration&gt;
        &lt;reportPlugins&gt;
         ....
            &lt;plugin&gt;
                &lt;groupId&gt;org.jvnet.mcvp&lt;/groupId&gt;
                &lt;artifactId&gt;maven-css-validator-plugin&lt;/artifactId&gt;
                &lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;
                &lt;reportSets&gt;
                    &lt;reportSet&gt;
                            &lt;reports&gt;
                                &lt;report&gt;report&lt;/report&gt;
                            &lt;/reports&gt;
                    &lt;/reportSet&gt;
                &lt;/reportSets&gt;
            &lt;/plugin&gt;
         .....
        &lt;/reportPlugins&gt;
   &lt;/configuration&gt;
    ....
&lt;/plugin&gt;
</pre>
<p><del datetime="2011-03-04T17:17:58+00:00">I assume that the <em>Could not find goal &#8216;index&#8217;</em> portion of the error means that if I set the name of the goal to index perhaps the reportsets are not necessary?</del></p>
<p><strong>Update:</strong> Changing the goal to &#8220;index&#8221; does indeed remove the need for the reportsets, however for legacy plugins you may not be able to modify the source code!</p>
<p>Another thing to note is that this plugin uses the <a href="http://wiki.jfrog.org/confluence/display/OSS/Maven+Anno+Mojo">Maven Anno Mojo</a></p>
<p>e.g.</p>
<pre class="brush: plain; title: ; notranslate">

@MojoGoal(&quot;index&quot;)
@MojoPhase(&quot;site&quot;)
public class CssReportingMojo extends AbstractMavenReport {
</pre>
<p>But I dont think this has anything to do with error.</p>
<p>I hope this is useful to anyone upgrading as I couldn&#8217;t find any info on this exception out there</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jsfblog.info/2011/03/upgrading-to-maven-3-site-reporting/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using maven to check facelets are valid</title>
		<link>http://www.jsfblog.info/2011/02/using-maven-to-check-facelets-are-valid/</link>
		<comments>http://www.jsfblog.info/2011/02/using-maven-to-check-facelets-are-valid/#comments</comments>
		<pubDate>Mon, 28 Feb 2011 11:36:00 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[JSF]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[validation]]></category>
		<category><![CDATA[xml-maven-plugin]]></category>

		<guid isPermaLink="false">http://www.jsfblog.info/?p=404</guid>
		<description><![CDATA[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&#8217;t welformed. Currently we are only doing it for facelets files (with a .xhtml extension): The xml snippet below shows the configuration [...]]]></description>
			<content:encoded><![CDATA[<p>Although eclipse validates our xml documents, sometimes invalid xml documents can get committed into our source repository by accident.</p>
<p>Using the <a href="http://maven.apache.org/" target="_blank">maven</a> <a href="http://mojo.codehaus.org/xml-maven-plugin/validation.html">xml-maven-plugin</a> we can force the build to break when xml documents aren&#8217;t welformed.</p>
<p>Currently we are only doing it for facelets files (with a .xhtml extension): The xml snippet below shows the configuration of the plugin for xhtml files.</p>
<p>Add this to the plugins element in the build section.</p>
<pre class="brush: xml; highlight: [16]; title: ; notranslate">
&lt;plugin&gt;
	&lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
	&lt;artifactId&gt;xml-maven-plugin&lt;/artifactId&gt;
	&lt;executions&gt;
		&lt;execution&gt;
			&lt;goals&gt;
				&lt;goal&gt;validate&lt;/goal&gt;
			&lt;/goals&gt;
		&lt;/execution&gt;
	&lt;/executions&gt;
	&lt;configuration&gt;
		&lt;validationSets&gt;
			&lt;validationSet&gt;
				&lt;dir&gt;src/main/webapp&lt;/dir&gt;
				&lt;includes&gt;
					&lt;include&gt;**/*.xhtml&lt;/include&gt;
				&lt;/includes&gt;
			&lt;/validationSet&gt;
		&lt;/validationSets&gt;
	&lt;/configuration&gt;
&lt;/plugin&gt;
</pre>
<p><strong>To Do:</strong></p>
<p>Really we should be validating all xml files. Also we should investigate turning on schema validation, especially for facelets files.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jsfblog.info/2011/02/using-maven-to-check-facelets-are-valid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Top reasons to adopt Maven 3</title>
		<link>http://www.jsfblog.info/2011/02/top-reasons-to-adopt-maven-3/</link>
		<comments>http://www.jsfblog.info/2011/02/top-reasons-to-adopt-maven-3/#comments</comments>
		<pubDate>Sat, 26 Feb 2011 14:02:35 +0000</pubDate>
		<dc:creator>Colin</dc:creator>
				<category><![CDATA[Maven]]></category>
		<category><![CDATA[hudson]]></category>
		<category><![CDATA[jenkins]]></category>
		<category><![CDATA[maven 3]]></category>
		<category><![CDATA[maven-site-plugin]]></category>
		<category><![CDATA[sonatype]]></category>

		<guid isPermaLink="false">http://www.jsfblog.info/?p=387</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>A great article was recently posted on the Sonatype blog on the <a href="http://www.sonatype.com/people/2011/02/top-ten-reasons-to-move-to-maven-3/" target="_blank">top 10 reasons to move to Maven 3</a></p>
<p>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.</p>
<p>Luckily, <a href="http://hudson-ci.org/" target="_blank">Hudson</a> / <a href="http://jenkins-ci.org/" target="_blank">Jenkins</a> makes it easy to test out running builds using different versions of Maven, so there is no reason not to test it out. Remember that the reporting has changed significantly in Maven 3, so while your project may build successfully in Maven 3 without any changes to the pom, you will need to make changes to get the reporting working. This article on the <a href="http://maven.apache.org/plugins/maven-site-plugin-3.0-beta-3/maven-3.html" target="_blank">Maven Site Plugin</a> explains the changes and shows an example of the new configuration.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jsfblog.info/2011/02/top-reasons-to-adopt-maven-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Maven pom Checkstyle configuration with Eclipse</title>
		<link>http://www.jsfblog.info/2011/02/maven-pom-checkstyle-configuration-with-eclipse/</link>
		<comments>http://www.jsfblog.info/2011/02/maven-pom-checkstyle-configuration-with-eclipse/#comments</comments>
		<pubDate>Tue, 22 Feb 2011 20:09:30 +0000</pubDate>
		<dc:creator>Colin</dc:creator>
				<category><![CDATA[Eclipse IDE]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[checkstyle]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[m2eclipse]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[pom]]></category>

		<guid isPermaLink="false">http://www.jsfblog.info/?p=355</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous post on <a href="http://www.jsfblog.info/2010/11/useful-eclipse-plugins/">Eclipse plugins</a>, 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 it is configured in the build section of the pom. If you just run Checkstlye as a reporting plugin, the plugins won&#8217;t pick up the configuration.</p>
<p>A very simple workaround for this is to take advantage of the <strong>skip</strong> parameter in the Checkstyle configuration. You can add the Checkstyle configuration into your build section of the pom and set the <strong>skip</strong> parameter to <strong>true</strong>. This will then prevent Checkstyle from running every time you build your project.</p>
<h3>Example code to use in your pom.xml</h3>
<pre class="brush: xml; highlight: [18]; title: ; notranslate">
&lt;properties&gt;
	&lt;checkstylePluginVersion&gt;2.6&lt;/checkstylePluginVersion&gt;
&lt;/properties&gt;
&lt;build&gt;
	&lt;plugins&gt;
		&lt;plugin&gt;
			&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
			&lt;artifactId&gt;maven-checkstyle-plugin&lt;/artifactId&gt;
			&lt;version&gt;${checkstylePluginVersion}&lt;/version&gt;
			&lt;executions&gt;
				&lt;execution&gt;
					&lt;goals&gt;
						&lt;goal&gt;check&lt;/goal&gt;
					&lt;/goals&gt;
				&lt;/execution&gt;
			&lt;/executions&gt;
			&lt;configuration&gt;
				&lt;skip&gt;true&lt;/skip&gt;
				&lt;configLocation&gt;customCheckstyle.xml&lt;/configLocation&gt;
			&lt;/configuration&gt;
			&lt;dependencies&gt;
				&lt;dependency&gt;
					&lt;groupId&gt;com.company.web&lt;/groupId&gt;
					&lt;artifactId&gt;company-maven-resources&lt;/artifactId&gt;
					&lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;
				&lt;/dependency&gt;
			&lt;/dependencies&gt;
		&lt;/plugin&gt;
	&lt;/plugins&gt;
&lt;/build&gt;
&lt;reporting&gt;
	&lt;plugins&gt;
		&lt;plugin&gt;
			&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
			&lt;artifactId&gt;maven-checkstyle-plugin&lt;/artifactId&gt;
			&lt;version&gt;${checkstylePluginVersion}&lt;/version&gt;
			&lt;configuration&gt;
				&lt;skip&gt;false&lt;/skip&gt;
				&lt;configLocation&gt;customCheckstyle.xml&lt;/configLocation&gt;
			&lt;/configuration&gt;
        &lt;/plugin&gt;
	&lt;/plugins&gt;
&lt;/reporting&gt;
</pre>
<p>In the above, we are also using a custom artifact as a dependency of the Checkstyle plugin. This artifact is a jar file which contains the customCheckstyle.xml file. We have also got the example code above in a parent pom file, which is in it&#8217;s own maven module with a packaging of pom, and artifactId of custom-super-pom. This way, any modules can specify custom-super-pom as their parent. Then when imported into Eclipse, they will automatically have Ckeckstyle configured, which will be referencing the customCheckstyle.xml file. Also, as these modules will inherit the reporting section from the custom-super-pom, they don&#8217;t need to have Checkstyle specified in them. This is great, since now all the configuration is in one single pom, making it much easier to maintain and update.</p>
<p>To change the customCheckstyle.xml file, all you would need to do is edit the file within the company-maven-resources artifact, and then install the artifact into your local repository. If you are also using a repository manager like <a href="http://nexus.sonatype.org/" target="_blank">Nexus</a>, then deploy it there also. The following command takes care of it all:</p>
<pre class="brush: plain; title: ; notranslate">
mvn clean deploy
</pre>
<p>We have used a snapshot version for our super pom and custom maven resources modules so that when these are changed, we can just deploy new versions on top of the older ones. Then any modules that reference these snapshots should pick up the latest version of the artifcats the next time they are built.  You can also force the update to happen by passing in -U on the command line when building, if you find that it doesn&#8217;t seem to be checking for updates to snapshots automatically.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jsfblog.info/2011/02/maven-pom-checkstyle-configuration-with-eclipse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Useful Eclipse Plugins</title>
		<link>http://www.jsfblog.info/2010/11/useful-eclipse-plugins/</link>
		<comments>http://www.jsfblog.info/2010/11/useful-eclipse-plugins/#comments</comments>
		<pubDate>Tue, 30 Nov 2010 12:52:11 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[checkstyle]]></category>
		<category><![CDATA[Cobertura]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[m2eclipse]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[pmd]]></category>

		<guid isPermaLink="false">http://www.jsfblog.info/?p=299</guid>
		<description><![CDATA[A list of handy plugins for the Eclipse IDE eCobertura &#8211; Allows Cobertura code coverage to be run from the IDE directly eclipse-cs &#8211; Enforces coding standards using the CheckStyle tool PMD &#8211; Scans Java code and reports potential problems M2Eclipse &#8211; Maven integration from Sonatype m2e-extensions &#8211; Works with version 0.10 of the M2Eclipse [...]]]></description>
			<content:encoded><![CDATA[<p>A list of handy plugins for the <a href="http://www.eclipse.org/">Eclipse IDE</a></p>
<ul>
<li><a href="http://ecobertura.johoop.de/" target="_blank">eCobertura</a> &#8211; Allows <a href="http://cobertura.sourceforge.net/" target="_blank">Cobertura</a> code coverage to be run from the IDE directly</li>
<li><a href="http://eclipse-cs.sourceforge.net/" target="_blank">eclipse-cs</a> &#8211; Enforces coding standards using the <a href="http://eclipse-cs.sourceforge.net/" target="_blank">CheckStyle</a> tool</li>
<li><a href="http://pmd.sourceforge.net/eclipse/" target="_blank">PMD</a> &#8211; Scans Java code and reports potential problems</li>
<li><a href="http://m2eclipse.sonatype.org/" target="_blank">M2Eclipse</a> &#8211; Maven integration from Sonatype
<ul>
<li><a href="http://code.google.com/p/m2e-extensions/" target="_blank">m2e-extensions</a> &#8211; Works with version 0.10 of the M2Eclipse plugin. Can automatically setup Checkstyle and PMD configuration for Eclipse to match their configuration from the pom file if they are in it</li>
<li><a href="http://bimargulies.github.com/m2e-code-quality/" target="_blank">m2e-code-quality</a> &#8211; Same as m2e-extensions, except this one works with version 0.12 of the M2Eclipse plugin</li>
</ul>
</li>
</ul>
<p><strong>Note:</strong> both m2e-extensions and m2e-code-quality only work if you have the pmd and checkstyle plugins configured in the build section of the pom. They do not currently work if you have pmd and checkstyle configured in the reporting section of the pom.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jsfblog.info/2010/11/useful-eclipse-plugins/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>JSF, Iterating with tomahawk radio buttons, t:datalist, a4j:repeat</title>
		<link>http://www.jsfblog.info/2010/05/jsf-iterating-with-tomahawk-radio-buttons-tdatalist-a4jrepeat/</link>
		<comments>http://www.jsfblog.info/2010/05/jsf-iterating-with-tomahawk-radio-buttons-tdatalist-a4jrepeat/#comments</comments>
		<pubDate>Fri, 14 May 2010 18:22:48 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[JSF]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[tomahawk]]></category>

		<guid isPermaLink="false">http://www.jsfblog.info/?p=224</guid>
		<description><![CDATA[The standard JSF radio buttons h:selectOneRadio render a load of old school html (i.e. they use table tags to do layout, (all a bit 1996)). e.g. JSF h:selectOneRadio tag Code for #{radioOptions} Note: I&#8217;m using jboss seam in the example above, but you could easily remove the seam annotations and define the bean in using [...]]]></description>
			<content:encoded><![CDATA[<p>The standard JSF radio buttons <a href="http://java.sun.com/javaee/javaserverfaces/1.2/docs/tlddocs/h/selectOneRadio.html">h:selectOneRadio</a> render a load of old school html (i.e. they use table tags to do layout, (all a bit 1996)).</p>
<p>e.g. JSF h:selectOneRadio tag</p>
<pre class="brush: xml; title: ; notranslate">
&lt;h:selectOneRadio id=&quot;aRadio&quot;&gt;
	&lt;f:selectItems value=&quot;#{radioOptions.items}&quot; /&gt;
&lt;/h:selectOneRadio&gt;
</pre>
<p>Code for #{radioOptions}</p>
<pre class="brush: java; title: ; notranslate">
import java.util.ArrayList;
import java.util.List;

import javax.faces.model.SelectItem;

import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;

@Name(&quot;radioOptions&quot;)
@Scope(ScopeType.APPLICATION)
public class RadioOptions
{
	public List&lt;SelectItem&gt; items = new ArrayList&lt;SelectItem&gt;();

	public RadioOptions()
	{
		items.add(new SelectItem(&quot;1&quot;, &quot;label 1&quot;));
		items.add(new SelectItem(&quot;2&quot;, &quot;label 2&quot;));
		items.add(new SelectItem(&quot;3&quot;, &quot;label 3&quot;));
	}

	public List&lt;SelectItem&gt; getItems()
	{
		return items;
	}

	public void setItems(List&lt;SelectItem&gt; items)
	{
		this.items = items;
	}
}
</pre>
<p>Note: I&#8217;m using jboss seam in the example above, but you could easily remove the seam annotations and define the bean in using jsf managed beans or faces config etc. Also the examples here are a bit mickey mouse and could be better.</p>
<p>Under JSF 1.2 will be rendered as</p>
<pre class="brush: xml; title: ; notranslate">
&lt;table id=&quot;myForm:aRadio&quot;&gt;
	&lt;tr&gt;
		&lt;td&gt;
			&lt;input type=&quot;radio&quot; name=&quot;myForm:aRadio&quot; id=&quot;myForm:aRadio:0&quot; value=&quot;1&quot; /&gt;
			&lt;label for=&quot;myForm:aRadio:0&quot;&gt;Label 1&lt;/label&gt;
		&lt;/td&gt;
		&lt;td&gt;
			&lt;input type=&quot;radio&quot; name=&quot;myForm:aRadio&quot; id=&quot;myForm:aRadio:1&quot; value=&quot;2&quot; /&gt;
			&lt;label for=&quot;myForm:aRadio:1&quot;&gt;Label 2&lt;/label&gt;
		&lt;/td&gt;
		&lt;td&gt;
			&lt;input type=&quot;radio&quot; name=&quot;myForm:aRadio&quot; id=&quot;myForm:aRadio:2&quot; value=&quot;3&quot; /&gt;
			&lt;label for=&quot;myForm:aRadio:2&quot;&gt;Label 3&lt;/label&gt;
		&lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;
</pre>
<p>Anyway this limitation is well known and as a result we&#8217;ve been using the apache tomahawk <a href="http://myfaces.apache.org/tomahawk-project/tomahawk12/tagdoc/t_selectOneRadio.html">t:selectOneRadio</a> (using the layout=&#8221;spread&#8221; attribute) and <a href="http://myfaces.apache.org/tomahawk-project/tomahawk12/tagdoc/t_radio.html">t:radio</a> tags to provide more flexible layouts which can be styled by css.</p>
<p><strong>Iterating through a list of select items</strong></p>
<p>There are times when I want to render the radio buttons in a flexible fashion (offered by t:radio) using a loop tag such as <a href="http://myfaces.apache.org/tomahawk-project/tomahawk12/tagdoc/t_dataList.html">t:dataList</a> or <a href="http://docs.jboss.org/richfaces/latest_3_3_X/en/tlddoc/a4j/repeat.html">a4j:repeat</a> e.g.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xmlns:ui=&quot;http://java.sun.com/jsf/facelets&quot; xmlns:h=&quot;http://java.sun.com/jsf/html&quot; xmlns:f=&quot;http://java.sun.com/jsf/core&quot; xmlns:fn=&quot;http://java.sun.com/jsp/jstl/functions&quot; xmlns:c=&quot;http://java.sun.com/jstl/core&quot; xmlns:t=&quot;http://myfaces.apache.org/tomahawk&quot; xmlns:a4j=&quot;https://ajax4jsf.dev.java.net/ajax&quot;&gt;
&lt;f:view&gt;
&lt;h:form id=&quot;myForm&quot;&gt;
	&lt;!-- radio button, layout spread  --&gt;
	&lt;t:selectOneRadio id=&quot;myRadio&quot; forceId=&quot;true&quot; layout=&quot;spread&quot;&gt;
		&lt;f:selectItems value=&quot;#{radioOptions.items}&quot; /&gt;
	&lt;/t:selectOneRadio&gt;

	&lt;!-- data list, loops through all the radio button options --&gt;
	&lt;t:dataList var=&quot;helper&quot; value=&quot;#{radioOptions.items}&quot; rowIndexVar=&quot;idx&quot;&gt;
		&lt;!-- example html, not constrained to table layout --&gt;
		&lt;h1&gt;Heading&lt;/h1&gt;
		&lt;t:radio for=&quot;myRadio&quot; index=&quot;#{idx}&quot;/&gt;
		&lt;h1&gt;Another Heading&lt;/h1&gt;
	&lt;/t:dataList&gt;
&lt;/h:form&gt;
&lt;/f:view&gt;
&lt;/html&gt;
</pre>
<p>Unfortunately this doesn&#8217;t work and throws:</p>
<pre class="brush: plain; title: ; notranslate">
java.lang.IllegalStateException: Could not find component 'myRadio' (calling findComponent on component 'myForm:j_id3:0:j_id5')
</pre>
<p><strong>The Fix:</strong></p>
<p>I <em>almost always</em> forget this which is why im blogging about it,</p>
<pre class="brush: xml; title: ; notranslate">
&lt;t:radio for=&quot;myRadio&quot; index=&quot;#{idx}&quot;/&gt;
</pre>
<p>needs to be replaced with</p>
<pre class="brush: xml; title: ; notranslate">
&lt;t:radio for=&quot;:myForm:myRadio&quot; index=&quot;#{idx}&quot;/&gt;
</pre>
<p>The tomahawk t:radio component must have the <a href="#fullyQualified"><em>fully qualified</em></a> component name of the t:selectOneRadio name otherwise it cannot find it.</p>
<p>Since the form is defined as:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;h:form id=&quot;myForm&quot;&gt;
</pre>
<p>:myForm needs to be prefixed to the for attribute of the t:radio giving :myForm:myRadio</p>
<p>I take absolutely no credit for this because its explained <a href="https://issues.apache.org/jira/browse/TOMAHAWK-26">here</a> and on the <a href="http://wiki.apache.org/myfaces/Display_Radio_Buttons_In_Columns">Myfaces wiki </a>this article is merely a note to self.</p>
<p>Btw, the above works with a4j:repeat as well as t:datalist</p>
<p><span style="text-decoration: line-through">Currently tomahawk isn&#8217;t working in JSF 2.0 which is a shame as we are looking to upgrade very soon. Hopefully a decent radio button will become part of JSF 2 at some point.</span></p>
<p>The<a href="http://myfaces.apache.org/tomahawk-project/tomahawk20/index.html"> tomahawk </a>component library now works with JSF 2.0</p>
<h5 id="fullyQualified">Update: Fully Qualified JSF Name</h5>
<p>A bit of searching around on the web took me to Lincoln Baxter&#8217;s blog  where he mentions <a href="http://ocpsoft.com/java/jsf2-java/how-to-jsf-2-0-render-components-outside-of-the-form/">rendering  components outside of the form</a> and explains that the first &#8220;:&#8221;  tells JSF to start looking from the very top of the JSF View Root. Thanks for that!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jsfblog.info/2010/05/jsf-iterating-with-tomahawk-radio-buttons-tdatalist-a4jrepeat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Maven site generation error: DTDDVFactoryImpl does not extend from DTDDVFactory</title>
		<link>http://www.jsfblog.info/2010/04/maven-site-generation-error-dtddvfactoryimpl-does-not-extend-from-dtddvfactory/</link>
		<comments>http://www.jsfblog.info/2010/04/maven-site-generation-error-dtddvfactoryimpl-does-not-extend-from-dtddvfactory/#comments</comments>
		<pubDate>Mon, 26 Apr 2010 11:35:01 +0000</pubDate>
		<dc:creator>Colin</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[exceptions]]></category>
		<category><![CDATA[maven-site-plugin]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[xerces]]></category>

		<guid isPermaLink="false">http://www.jsfblog.info/?p=197</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>When generating a site with Maven, we encountered the following exception when a particular reporting plugin was executed:</p>
<pre class="brush: plain; title: ; notranslate">
org.apache.xerces.impl.dv.DVFactoryException:
DTD factory class org.apache.xerces.impl.dv.dtd.DTDDVFactoryImpl does not extend from DTDDVFactory.
</pre>
<p>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 to the <a title="Maven Site Plugin" href="http://maven.apache.org/plugins/maven-site-plugin/">maven-site-plugin</a> which we had recently upgraded to use version 2.1 of the plugin by specifying it in our pom file like so:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;pluginManagement&gt;
	&lt;plugins&gt;
		&lt;plugin&gt;
			&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
			&lt;artifactId&gt;maven-site-plugin&lt;/artifactId&gt;
			&lt;version&gt;2.1&lt;/version&gt;
		&lt;/plugin&gt;
	&lt;/plugins&gt;
&lt;/pluginManagement&gt;
</pre>
<p>The maven-site-site plugin has the following dependency structure:</p>
<ul>
<li>org.apache.maven.plugins:maven-site-plugin:maven-plugin:2.1
<ul>
<li>org.apache.maven.doxia:doxia-module-xhtml:jar:1.1.2 (compile)
<ul>
<li>org.apache.maven.doxia:doxia-core:jar:1.1.2 (compile)
<ul>
<li>xerces:xercesImpl:jar:2.8.1 (compile)</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>It is the dependency of the xercesImpl jar 2.8.1 that is the problem. To get around this issue, you can tell the maven-site-plugin to exclude a particular dependency. This can be done like so:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;pluginManagement&gt;
	&lt;plugins&gt;
		&lt;plugin&gt;
			&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
			&lt;artifactId&gt;maven-site-plugin&lt;/artifactId&gt;
			&lt;version&gt;2.1&lt;/version&gt;
			&lt;dependencies&gt;
				&lt;dependency&gt;
					&lt;groupId&gt;org.apache.maven.doxia&lt;/groupId&gt;
					&lt;artifactId&gt;doxia-core&lt;/artifactId&gt;
					&lt;version&gt;1.1.2&lt;/version&gt;
					&lt;exclusions&gt;
						&lt;exclusion&gt;
							&lt;groupId&gt;xerces&lt;/groupId&gt;
							&lt;artifactId&gt;xercesImpl&lt;/artifactId&gt;
						&lt;/exclusion&gt;
					&lt;/exclusions&gt;
				&lt;/dependency&gt;
			&lt;/dependencies&gt;
		&lt;/plugin&gt;
	&lt;/plugins&gt;
&lt;/pluginManagement&gt;
</pre>
<p>There are a couple of maven reporting plugins that we found produced this exception when run with maven-site-plugin 2.1. These plugins are:</p>
<ul>
<li><a title="DocFlax XML Maven Plugin" href="http://www.filigris.com/downloads/view/docflex_xml/maven/index.html">DocFlex/XML Maven Plugin</a></li>
<li><a title="Canoo Webtest Maven Plugin" href="http://people.apache.org/~sgoeschl/download/maven-plugins/webtest-maven-plugin/site/index.html">Canoo Webtest Maven Plugin</a></li>
</ul>
<p>If you use an older version of the maven-site-plugin then the above mentioned reporting plugins should work ok. It is only when specifying a version of 2.1 or above that the exception occurs.</p>
<p>Some of the solutions suggested on the net didn&#8217;t work for us, like adding the xercesImpl jar as a dependency to the actual reporting plugin in question, so hopefully the solution mentioned in this post is helpful.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jsfblog.info/2010/04/maven-site-generation-error-dtddvfactoryimpl-does-not-extend-from-dtddvfactory/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

