Maven shell utilities that use the grab layout.
For automating the release of a maven project the maven_release function is provided:
For example:
#!/bin/bash
source $(grab github.com/shellib/maven)
pushd workspace/src/github.com/sundrio/sundrio/
maven_release --release-version 0.8.1 --dev-version 0.8-SNAPSHOT
popd
The actual options supported by the command are:
Option | Required | Description |
---|---|---|
–release-version | false | The release version (will bump micro version if missing) |
–dev-version | false | The version that will be set after the release (will bump micro version) |
–release-snapshots | false | Release snapshot artifacts |
–staging-profile-id | false | The staging profile id (as seen in the nexus console) |
–nexus-rul | false | The nexus server url |
–dry-run | false | Dry run. No release will take place |
If the options for release and dev version are skipped, they will be calculated with the following rules:
- If the version found in the pom.xml uses MAJROR.MINOR.MICRO-SNAPSHOT style, then the release version will be MAJOR.MINOR.MICRO and the dev version will be MAJOR.MINOR.MICRO + 1.
- If the version found in the pom.xml uses MAJOR.MINOR-SNAPSHOT style, then the dev version will be kept the same and the release version will be calculated using the MICRO of latest release with matching MAJOR and MINOR versions + 1.
When automating a release process its often desirable to wait until the release is available and synchronization of artifacts to the target repository has been completed. For this purpose is_release_available has been created. This function accepts two arguments (groupId, artifactId and version) and optionally the repository url and return true or false.
Option | Required | Description |
---|---|---|
–repo-url | true | The url of the target repository (including the path prefix) |
This function is meant to be used along with a polling mechanism.
For example it can play nicely with shellib’s wait utility.
#!/bin/bash
source $(grab github.com/shellib/maven)
source $(grab github.com/shellib/wait)
is_on_central() {
is_release_available my.group.id my-artifact-id 1.0.0
}
wait_for --function is_on_central --backoff-multiplier 3 --max-wait-time 7200