Lives in the UK. Likes blogging, cycling and eating lemon drizzle cake. Roger is a DZone MVB and is not an employee of DZone and has posted 143 posts at DZone. You can read more from them at their website. View Full User Profile

Adding a Site to your Maven Project

11.10.2011
| 3382 views |
  • submit to reddit

Once you’ve got your Maven project built and sorted, one of the neat tricks you can do to make it look even more professional is to add a Maven Site. Maven gives you the ability to add a whole site structure with one simple command.

mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes
    -DarchetypeArtifactId=maven-archetype-site
    -DarchetypeVersion=1.0
    -DgroupId=com.company 
    -DartifactId=project 
    -Dversion=1.0 
    -Dpackage=1.5

…where all the above is on one line. This will add the following directory structure in to your project's src directory.



Generating the site from these files and pushing it into your target directory is then simply a matter of issuing the following Maven command:

mvn clean site

…and that’s all there is to it. If you open the target/site/index.html file in your browser, you’ll see something like this:


Of course there’s the little matter of adding some content and publishing it to a server somewhere, but that’s a matter for another blog.

 

From http://www.captaindebug.com/2011/11/adding-site-to-your-maven-project.html

Published at DZone with permission of Roger Hughes, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Tags: