Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "MavenReleaseScript"

(Sample Maven Central Release Script)
 
Line 7: Line 7:
 
  JAVA_HOME="${JAVA_PREFIX}/jdk-8/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"
 
  PATH="${MVN_HOME}/bin:${JAVA_HOME}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
 
 
  # Maven plugins
 
  # Maven plugins
 
  NEXUS_PLUGIN='org.sonatype.plugins:nexus-staging-maven-plugin:1.6.7'
 
  NEXUS_PLUGIN='org.sonatype.plugins:nexus-staging-maven-plugin:1.6.7'
 
  NEXUS_PLUGIN_PARAMS='-DnexusUrl=https://oss.sonatype.org/ -DserverId=ossrh'
 
  NEXUS_PLUGIN_PARAMS='-DnexusUrl=https://oss.sonatype.org/ -DserverId=ossrh'
 
 
  mvnq() {
 
  mvnq() {
    # filter out progress reports (-B) and download details
+
    # filter out progress reports (-B) and download details
    mvn -B "$@" | grep -v '^\[INFO\] Download'
+
    mvn -B "$@" | grep -v '^\[INFO\] Download'
 
  }
 
  }
 
+
  # List
  # Uncomment to list the available staging repo ids
+
  if [[ ${LIST_REPOS} = "true" ]]; then
  # mvnq ${NEXUS_PLUGIN_PARAMS} ${NEXUS_PLUGIN}:rc-list
+
  echo '-[ List turned on ]----------------------------------------------------------'
  echo "Releasing repositoryID=$ID"
+
  mvnq ${NEXUS_PLUGIN_PARAMS} ${NEXUS_PLUGIN}:rc-list
mvnq -DstagingRepositoryId="$ID" ${NEXUS_PLUGIN_PARAMS} ${NEXUS_PLUGIN}:rc-release
+
  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.
 
The full view of the release job for Jakarta Dependency Injection is shown in the attached release-job.pdf file.

Latest revision as of 17:20, 30 August 2019

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