Repository Management with Nexus
To deploy a site to a Nexus Site repository, you will need to configure the project’s distribution management settings, add site deployment information, and then update your Maven settings to include the appropriate credentials for Nexus.
Add the following section to sample-site/pom.xml before the dependencies element. This section will tell Maven where to publish the Maven-generated project website:
<distributionManagement> <site> <id>nexus</id> <url>dav:http://localhost:8081/nexus/content/sites/site/</url> </site> </distributionManagement>
The URL in the distribution management is not parameterized, which means that any redeployment overwrites old content and potentially leaves old stale files behind. To have a new deployment directory for each version, change the URL to a parameterized setup or a hardcoded specific URL for your project.
If you combine this approach with a redirector or a static page that links to the different copies of your site, you can e.g., maintain separate sites hosting your javadoc and other documentation for different releases of your software.
The dav protocol used by for deployment to Nexus requires that you add the implementing library as a dependency to the Maven site plugin configuration.
Configuring Version 3.4 of the Maven Site Plugin with DAV support.
<build> <plugins> <plugin> <artifactId>maven-site-plugin</artifactId> <version>3.4</version> <dependencies> <dependency> <groupId>org.apache.maven.wagon</groupId> <artifactId>wagon-webdav-jackrabbit</artifactId> <version>2.6</version> </dependency> </dependencies> </plugin> </plugins> </build>