Interacting with SDKMan from your Jenkins Pipelines
SDKMan is available on all our agents for our developers to update and manage the versions of all their Java dependencies. The following tools can be installed on demand on any of our agents.
activemq,ant,asciidoctorj,ballerina,bpipe,btrace,concurnas,connor,cuba,cxf,doctoolchain,flink,gaiden,gradle,gradleprofiler,grails,groovy,groovyserv,hadoop,http4k,infrastructor,java,jbake,jbang,jmc,jmeter,joern,jreleaser,karaf,kcctl,ki,kobweb,kotlin,kscript,layrry,leiningen,maven,mcs,micronaut,mulefd,mvnd,mybatis,neo4jmigrations,pierrot,pomchecker,quarkus,sbt,scala,scalacli,schemacrawler,spark,springboot,sshoogr,taxi,test,tomcat,toolkit,vertx,visualvm,webtau,znai
The interface for managing versions is reasonably simple to do the following.
sdk list <packagename>
sdk install <packagename>
sdk install gradle 7.5
To use SDKMan in your pipelines, do the following. Add the SDKMAN shim to the top of the pipeline. The shim is only required if you want to interact with the SDKMan script.
set +x
[[ -s "$HOME/.bash_profile" ]] && source "$HOME/.bash_profile"
set -x
Globals = [:]
pipeline {
agent {
label 'android-agent'
}
options{
disableConcurrentBuilds()
buildDiscarder(logRotator(numToKeepStr: '5'))
}
stages {
stage('LoadSDKMAN') {
steps {
sh '''
set +x
[[ -s "$HOME/.bash_profile" ]] && source "$HOME/.bash_profile"
set -x
sdk install gradle
sdk install java
'''
}
}
stage('Versions'){
steps {
sh '''
gradle -version
java -version
'''
}
}
}
}
Check out the [SDKman](https://sdkman.io/usage) documentation here.
Updated on: 31/10/2025
Thank you!