Skip to content

Latest commit

 

History

History
66 lines (46 loc) · 3.25 KB

README.org

File metadata and controls

66 lines (46 loc) · 3.25 KB

maven

Maven shell utilities that use the grab layout.

Features

automating releases

check if artifact is available on repo.

Automating Releases

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:

OptionRequiredDescription
–release-versionfalseThe release version (will bump micro version if missing)
–dev-versionfalseThe version that will be set after the release (will bump micro version)
–release-snapshotsfalseRelease snapshot artifacts
–staging-profile-idfalseThe staging profile id (as seen in the nexus console)
–nexus-rulfalseThe nexus server url
–dry-runfalseDry run. No release will take place

Skipping version

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.

Checking if artifact is available on repository.

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.

OptionRequiredDescription
–repo-urltrueThe 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