TaT CreateMavenSiteNB65

Create a Maven project site in NetBeans

by Hubert A. Klein Ikkink; first published in blog


Within a Maven project it is easy to create a project site. We need to create the src/site directory and place a site.xml file in it. And of course we can add content files for the project site. To generate the site we only have to run mvn site. And if we use NetBeans we can generate the site with a mouse click.

In our Maven project we have a Project site node. If we right-click on the node we get the following pop-up menu:

Image:mavensite1_TaT_CreateMavenSiteNB65.png

We notice the options Generate Site and Deploy Site. If we select Generate Site we get a dialog window with the Maven command that is about to run:

Image:mavensite2_TaT_CreateMavenSiteNB65.png

We could change some fields here, but most of the time we just press the OK button. And the project site is generated. The generated site is placed in the target/site directory. If we look at the output window and see the Maven output we notice a link View Generated Project Site:

Image:mavensite3_TaT_CreateMavenSiteNB65.png

We can click on this link and NetBeans will open the site's index.html file in a web browser.

We can also deploy the project site to a web server with the Deploy Site option from the pop-up menu. This command is executed immediately by NetBeans and the if the configuration in our pom.xml is correct, the site is deploy to a web server.

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo