Once a site report is generated, it needs to be published. While this can be done manually, Maven also provides facilities to do this. Let us see how.
To publish a site, you need to have access to the web server where the site has to be deployed.
To deploy a site, use the following steps:
pom.xml
file. This could also be added in settings.xml
:<distributionManagement> <site> <id>myorg</id> <url>scp://www.myorg.com/project/</url> </site> </distributionManagement>
settings.xml
file:<servers> <server> <id>myorg</id> <username>username</username> <password>password</password> <filePermissions>664</filePermissions> <directoryPermissions>775</directoryPermissions> </server> </servers>
mvn site-deploy
When the site-deploy
goal is run, Maven first builds the site. Then, it uses the entry set in the distributionManagement
element to determine how the site needs to be deployed. The first part of the URL is the protocol to be used to transfer the file. In this case, it is scp
. It uses the credentials specified in the settings.xml
file and transfers the file to the destination.
If you want to test your site before deploying, you can easily do so in the following way:
mvn site:run
http://localhost:8080
:The run goal of the Maven Site plugin deploys the site in a jetty server, which is started by default by port 8080
. This allows you to view the site report and verify it before publishing.
3.17.79.20