Usage
Add the plugin to your pom:
<build>
<plugins>
<plugin>
<groupId>com.github.danielflower.mavenplugins</groupId>
<artifactId>multi-module-maven-release-plugin</artifactId>
<version>3.6.4</version>
<configuration>
<releaseGoals>
<releaseGoal>deploy</releaseGoal>
</releaseGoals>
</configuration>
</plugin>
</plugins>
</build>
And then call the plugin:
mvn releaser:release
You can also optionally supply your own build numbers if you do not want an automatically incrementing number:
mvn releaser:release -DbuildNumber=1234
Running a partial release
It is possible to release a single module (and any modules it depends on) by using the modulesToRelease
parameter.
For example:
mvn releaser:release -DmodulesToRelease=MyApp
In this case the MyApp
module will be built, released and tagged. If MyApp depends on another module, than that module will
also be built and released (but there will be no Git tag for this).
Note that this is not generally required as the plugin will only deploy changed modules by default anyway.
Forcing a release
It is possible to force the release of one or more specified modules, for example if the changes have not been picked up due to some issue.
To do this, use the forceRelease
parameter. For example:
mvn releaser:release -DforceRelease=MyApp
In this case the MyApp
module will be built, even if there where no changes found.
Specify custom global/user Maven settings for release build
Sometimes it's necessary to specify custom Maven settings for the release build. This can be done with the following standard maven command line parameters:
mvn releaser:release -s /path/to/custom/user/settings.xml -gs /path/to/custom/global/settings.xml
Authentication
Please see SSH Authentication or HTTPS Authentication.
Determining which modules have changed
When determining which modules have changed since the previous release, the previously built artifacts must be available. Artifacts can be in a local or remote maven repository. If the previously built artifacts are not available, all modules will be considered changed.
Version reports
Version report generation is supported for both the released modules (version incremented) and non-released modules (latest version).
The supported report formats are FLAT(line separated) and JSON.
<versionReports>
<versionReport>
<versionsReportFilePath>released-report.txt</versionsReportFilePath>
<versionsReportFormat>FLAT</versionsReportFormat>
<releasedModulesOnly>true</releasedModulesOnly>
</versionReport>
<versionReport>
<versionsReportFilePath>version-report.json</versionsReportFilePath>
<versionsReportFormat>JSON</versionsReportFormat>
<releasedModulesOnly>false</releasedModulesOnly>
</versionReport>
</versionReports>