Paul Verest
Paul Verest

Reputation: 63912

How to get/publish multi-module maven project site into a folder

I have multi-module maven project. I can see generated project dosumentation after mvn site, but it is in every module target folder.

how to get maven project site into one folder? (I don't really need to deploy, I will put generated site manually into GitHub pages.)

Plugin docs:

http://maven.apache.org/plugins/maven-site-plugin/

References <distributionManagement> <site> section, but there is no trace how to make output into a defined folder. Also tried mvn site:jar - it make .jar again in every module target.

Upvotes: 0

Views: 166

Answers (1)

khmarbaise
khmarbaise

Reputation: 97407

I would recommend to use the site-maven-plugin following part to distribute generated sites to github:

<profile>
  <id>github</id>
  <build>
    <plugins>
      <plugin>
        <groupId>com.github.github</groupId>
        <artifactId>site-maven-plugin</artifactId>
        <version>0.8</version>
        <configuration>
          <message>Creating site for ${project.version}</message>
          <server>github</server>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>site</goal>
            </goals>
            <phase>post-site</phase>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

</profile>

To preview your site before publishing you can use the stage goal of maven-site-plugin like this:

mvn site:stage -DstagingDirectory=C:\fullsite

Upvotes: 1

Related Questions