Sunday, January 02, 2011

Eclipse Maven site issues

Following up on my previous posts about Maven, Eclipse on Tomcat, I ran into a a very interesting problem that I wanted to share with you so that you don't waste time like I did.


Running 'mvn site' from Eclipse does not generate reports


Problem

As I was getting ready to release my Maven project in Eclipse, I wanted to generate a project site with FAQs, javadoc and junit reports. So, I decided to use the standard 'mvn site' command.

I edited my pom following the instructions at http://maven.apache.org/plugins/maven-site-plugin/ and http://maven.apache.org/plugins/maven-javadoc-plugin/examples/selective-javadocs-report.html.

With my pom edited, I ran the mvn site command from Eclipse. The site was generated but it had no reports and no javadoc. I had no idea why this was and searched all over the Maven forums and Google but, had no luck.

I then decided to fall back to the reliable command-line and presto, the site generated with all the reports and javadoc. I came to the sudden realization that Maven may not have been configured properly in Eclipse.

Root Cause

I found that my Eclipse Maven installation was using the default embedded version of Maven which was at 3.0. And, the changes I had made in my pom were intended for Maven 2.2. Due to incompatibility issues, my Eclipse Maven was ignoring the reporting tags in my pom.

Solution

The solution was straighforward. I just had to go to Workbench -> Preferences -> Maven -> Installations and add the path to Maven 2.2 installed on my filesystem.



I hope the above information is helpful to you and saves you some time.

Ciao!

No comments: