Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

MavenReleaseScript

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