The maven-scm-publish-plugin is a utility plugin to allow publishing Maven website to any supported SCM. The primary goal was to have an utility plugin to allow Apache projects to publish Maven websites via the ASF svnpubsub system
In addition to SCM operations, it takes care to fix newline inconsistencies generated by maven-site-plugin, which prevents simple content import to SCM.
The plugin has been tested with git scm too and by example can push content for github pages too.
The plugin works from staged website.
It first checks out the contents of a directory from the SCM into (by default) target/scmpublish-checkout.
Then locally staged content is applied to the check-out, issuing appropriate SCM commands to add and delete entries, followed by a checkin.
The scmpublish.dryRun parameter to the plugin avoids all SCM operations, and simply logs out the added, deleted, and changed files.
The scmpublish.skipCheckin parameter omits the final checkin. This allows you to visit target/scmpublish-checkout, and validate its contents before submitting to the SCM.
Even without any pom.xml/Maven project, you can update SCM content with a local content:
mvn scm-publish:publish-scm -Dscmpublish.pubScmUrl=scm:... -Dscmpublish.content=...path-to-content...
SCM content will be checked-out to a temporary directory, then local content will be applied to the check-out, before it is checked-in back.
See maven.apache.org content import script for an example.
See Some Tips.
There are 2 known limitations:
Ideally, scm urls would be supported in <distributionManagement> section of the POM, then publishing would simply be mvn site-deploy, without any problems for non-flat multi-modules sites.
To reach such a dream, there are some steps:
Then this plugin will be outdated, replaced by natural maven-site-plugin:deploy.