Skip to main content
Jump to: navigation, search

MavenReleaseScript

Revision as of 16:20, 30 August 2019 by Starksm64.gmail.com (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Sample Maven Central Release Script

This page describes a simple Jenkins freestyle job that can be used to optionally list the staging repository ids available to the Jenkins user, and then release a given staging repository. The job has an ID parameter to pass in the staging repository to release.

TOOLS_PREFIX='/opt/tools'
JAVA_PREFIX="${TOOLS_PREFIX}/java/oracle"
MVN_HOME="${TOOLS_PREFIX}/apache-maven/latest"
JAVA_HOME="${JAVA_PREFIX}/jdk-8/latest"
PATH="${MVN_HOME}/bin:${JAVA_HOME}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# Maven plugins
NEXUS_PLUGIN='org.sonatype.plugins:nexus-staging-maven-plugin:1.6.7'
NEXUS_PLUGIN_PARAMS='-DnexusUrl=https://oss.sonatype.org/ -DserverId=ossrh'
mvnq() {
    # filter out progress reports (-B) and download details
    mvn -B "$@" | grep -v '^\[INFO\] Download'
}
# List
if [[ ${LIST_REPOS} = "true" ]]; then
  echo '-[ List turned on ]----------------------------------------------------------'
  mvnq ${NEXUS_PLUGIN_PARAMS} ${NEXUS_PLUGIN}:rc-list
fi
# Release
if [[ ${DRY_RUN} != "true" ]]; then
  echo "Releasing repositoryID=$ID"
  mvnq -DstagingRepositoryId="$ID" ${NEXUS_PLUGIN_PARAMS} ${NEXUS_PLUGIN}:rc-release  
fi

The full view of the release job for Jakarta Dependency Injection is shown in the attached release-job.pdf file. File:Release-job.pdf

Back to the top