During the application phase, the plugin initializes the project.version according to the contents of a
version.txt file (e.g. 1.2.3-SNAPSHOT).
During the configuration phase, the plugin checks if any of the releaseXXX tasks is called explicitly. It
then upgrades the project.version and version.txt contents according to the following strategies:
Task release: Remove -SNAPSHOT from current version (e.g. 1.2.3)
Task releaseMajorVersion: Upgrade to next major version (e.g. 2.0.0)
Task releaseMinorVersion: Upgrade to next minor version (e.g. 1.3.0)
During the execution phase, the releaseXXX tasks tag the Git repository and prepare the version.txt contents
for the next SNAPSHOT iteration. The tasks perform the following steps:
Commit modified version.txt
Tag Git repo (e.g. v1.2.3)
Increment version number in version.txt to next SNAPSHOT (e.g. 1.2.4-SNAPSHOT)
Again commit modified version.txt
Optionally push changes to Git remote (works from any branch)
Note that all releaseXXX tasks run non-interactively and are thus well suited for continuous integration.
Configuration
This plugin follows a "no surprise" policy. Consequently, no configuration is needed in the majority of cases. The
following snippet illustrates all configuration options, their default values, and possible alternatives:
release {
dependsOn build // 'distZip' could e.g be used in combination with the 'application' plugin
push =false// 'true' would e.g. be useful when triggering the release task on a CI server
versionSuffix ='-SNAPSHOT'// '.DEV' or '' (empty) could be useful alternatives
tagPrefix ='v'// 'r' or '' (empty) could be useful alternatives
}
Note: In multi-projects scenarios, the root project usually does not have a build task. Consequently, the
release task will fail with its current default settings. Please use release.dependsOn subprojects.build
(after the subprojects block) to work around
this issue.
Read-Only Properties
Use project.release.versionFile to e.g. include the version.txt file in your final release bundle. The Git release
tag can be accessed via project.release.tagName.
请发表评论