logo Apache Maven Site Plugin

The Maven Site Plugin is a plugin that generates a site for the current project.

homepage: maven.apache.org/plugins
fresh index:
last release: 4 weeks ago, first release: 2 decades ago
packaging: maven-plugin
get this artifact from: central nuxeo
see this artifact on: search.maven.org


Display vulnerabilities (snyk): Vulnerability check

This chart shows how much is this artifact used as a dependency in other Maven artifacts in Central repository and GitHub:


select version:

Add this snippet into pom.xml inside tag <project><build><plugins>:




Switch to artifact.
goals:
site:attach-descriptor (phase: package)

Adds the site descriptor (site.xml) to the list of files to be installed/deployed. For Maven-2.x this is enabled by default only when the project has pom packaging since it will be used by modules inheriting, but this can be enabled for other projects packaging if needed. This default execution has been removed from the built-in lifecycle of Maven 3.x for pom-projects. Users that actually use those projects to provide a common site descriptor for sub modules will need to explicitly define this goal execution to restore the intended behavior.

site:deploy

Deploys the generated site using wagon supported protocols to the site URL specified in the <distributionManagement> section of the POM. For scp protocol, the website files are packaged by wagon into zip archive, then the archive is transfered to the remote host, next it is un-archived which is much faster than making a file by file copy.

site:effective-site

Displays the effective site descriptor as an XML for this build, after inheritance and interpolation of site.xml, for the first locale.

site:help

Display help information on maven-site-plugin. Call mvn site:help -Ddetail=true -Dgoal=<goal-name> to display parameter details.

site:jar (phase: package)

Bundles the site output into a JAR so that it can be deployed to a repository.

site:run

Starts the site up, rendering documents as requested for faster editing. It uses Jetty as the web server.

site:site

Generates the site for a single project. Note that links between module sites in a multi module build will not work, since local build directory structure doesn't match deployed site.

site:stage

Deploys the generated site to a local staging or mock directory based on the site URL specified in the <distributionManagement> section of the POM. It can be used to test that links between module sites in a multi-module build work. This goal requires the site to already have been generated using the site goal, such as by calling mvn site.

site:stage-deploy

Deploys the generated site to a staging or mock URL to the site URL specified in the <distributionManagement> section of the POM, using wagon supported protocols

Often used code snippets:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-site-plugin</artifactId>
  <configuration>
    <locales>en,es,ja,fr,zh_CN,ko</locales>
  </configuration>
</plugin>
<plugin>
  <artifactId>maven-site-plugin</artifactId>
  <executions>
    <execution>
      <id>attach-descriptor</id>
      <goals>
        <goal>attach-descriptor</goal>
      </goals>
      <configuration>
        <generateReports>true</generateReports>
      </configuration>
    </execution>
  </executions>
</plugin>
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-site-plugin</artifactId>
  <version>3.0</version>
  <configuration>
    <reportPlugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-project-info-reports-plugin</artifactId>
        <version>2.2</version>
        <configuration>
          <dependencyDetailsEnabled>true</dependencyDetailsEnabled>
          <dependencyLocationsEnabled>true</dependencyLocationsEnabled>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>2.7</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-report-plugin</artifactId>
        <version>2.6</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>2.6</version>
      </plugin>
    </reportPlugins>
  </configuration>
</plugin>
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-site-plugin</artifactId>
  <configuration>
    <generateReports>false</generateReports>
  </configuration>
</plugin>
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-site-plugin</artifactId>
  <version>3.0</version>
  <configuration>
    <skip>true</skip>
    <skipDeploy>true</skipDeploy>
  </configuration>
</plugin>

© Jiri Pinkas 2015 - 2022. All rights reserved! Admin login To submit bugs / feature requests please use this github page
related: JavaVids | Top Java Blogs | Java školení
Apache and Apache Maven are trademarks of the Apache Software Foundation. The Central Repository is a service mark of Sonatype, Inc.