Showing posts with label site plugin. Show all posts
Showing posts with label site plugin. Show all posts

Wednesday, September 30, 2009

Building a Site and using Properties

When building a site in Maven you are likely to want to use custom properties, such as the version #, artifact/group ids and so forth. This isn't as easy as it should be. First you'll need to attach an extra '.vm' to the end of any apt, fml file that you want to be filtered. Without this the ${property} references in these files will not be replaced with values.

A word on the properties you'll use in these site template files. They may not have '.'s in them. That's right you can't have a property such as 'pom.version' in your templates. So instead you'll need to add properties that do not use this character.


<properties>
<currentVersion>${pom.version}</currentVersion>
<properties>


Then in your apt file you can now put in ${currentVersion} and it will resolve to the pom's version element value in the generated html file.

Monday, July 2, 2007

Generate Website and View It Locally

The problem:

You are using Maven to create documentation on your project. You want to use the site plug in to generate this documentation into a website. What you need is a quick way to proof your changes, seeing how they look on the website.

The solution:

This one blew me away. When you are working on your documentation you can easily view changes, just run this command:
mvn site:run
This will get a Jetty web server going with your web site running on it. Now just go to localhost:8080 to see your site. This technique is really helpful when configuring reports, as you can quickly test them out.

If a project is configured with the Javadoc report there are some nice uses here. you can pop up a site while working on a project and view the Javadoc. This is a useful technique when first checking out a project, so that you may better familiarize yourself with it.