Fork me on GitHub

Quickstart Guide

  • Your Maven project has a site generated in target/site, and this site is ready to be deployed.
  • Your project sources are hosted on a Github repository
  • You have the authorizations to push code to this repository.

In your project’s pom file, add com.github.github:site-maven-plugin:maven-plugin:0.9 in the plugin list.

<plugin>
    <!-- Deploy the web site -->
    <groupId>com.github.github</groupId>
    <artifactId>site-maven-plugin</artifactId>
    <version>0.9</version>
    <executions>
        <execution>
            <goals>
                <goal>site</goal>
            </goals>
            <!-- select the Maven phase in which the plugin will be executed -->
            <phase>site-deploy</phase>
            <configuration>
                <!-- Plugin configuration ges here -->

                <server>github</server>

                <!-- The commit message -->
                <message>Building site for my project</message>
                <!-- The location where the site is uploaded -->
                <path>${site.path}</path>
                <!-- Use merge or override the content -->
                <merge>true</merge>
            </configuration>
        </execution>
    </executions>
</plugin>

To know more about plugin’s configuration and parameters check the (mojo page)[TODO].

It’s also important to configure the project url to indicate the project’s Github repository, such as in:

<url>https://github.com/nanoko-project/coffee-mill-maven-plugin</url>

There are other ways to indicate the Github project on which the site will be published. Check the (configure project)[configure-project] page.

Now that the plugin is configured, and the project location is specified correctly, you need to provide your Github credentials. These credentials are used by Maven to push the site.

Open your Maven settings (~/.m2/settings.xml) and add the following server configuration:

<server>
    <id>github</id>
    <username>YOUR_GITHUB_USERNAME</username>
    <password>YOUR_PASSWORD</password>
</server>

Executing the plugin

If you choose the `site phase in the plugin configuration, the Maven site is generated and uploaded with:

mvn clean site