'How to use "readProperties file:" in jenkins
So I am using a very old svn (1.6.23_32) and jenkins version.
I am trying to run the following in my Jenkinsfile-
def p = readProperties file: 'versions.properties'
def SVN_TAG="ccsmp_v_${p.version.major}.${p.version.minor}.${p.version.maintenance}.${p.version.build}"
But I am getting the following error -
java.lang.NoSuchMethodError: No such DSL method 'readProperties' found among [ansiColor, archive, bat, build, catchError, checkout, deleteDir, dir, echo, emailext, emailextrecipients, error, fileExists, git, input, isUnix, load, mail, node, parallel, properties, publishHTML, pwd, readFile, retry, sh, slackSend, sleep, sshagent, stage, stash, step, svn, timeout, timestamps, tool, unarchive, unstash, waitUntil, withEnv, wrap, writeFile, ws]
"versions.properties" have following contents-
#ccsmp build version information
#Tue, 12 Apr 2022 15:32:37 -0400
branch.type=feature
cscsmp.svn.branch=branches/features/javarto_maven
ivy.cache.dir.name=${svn.branch}
jrto.version=${jrto.version.major}.${jrto.version.minor}.${jrto.version.maintenance}
jrto.version.build=26856
jrto.version.maintenance=0
jrto.version.major=0
jrto.version.minor=0
lib.version=1.5
openvms_pass=xyz
openvms_server=xyz
openvms_user=loadxyz
svn.branch=branches/features/CRE-442
svn.branchurl=${svn.rooturl}/${svn.branch}
svn.password=xyz
svn.rooturl=svn\://xyz-repo/svn/ccsmp
svn.tagurl=${svn.rooturl}/tags
svn.username=xyz
version.build=846
version.date=2022/04/12 15\:32
version.maintenance=0
version.major=1
version.minor=37
version.release=${version.major}.${version.minor}.${version.maintenance}.${version.build}
Is there any alternative way to doing this? Any suggestions are highly appreciated
UPDATE: I also tried -
def p = readFile 'versions.properties'
p = new Properties().load( new StringReader(p) )
def SVN_TAG="ccsmp_v_${p.version.major}..."
But this also didn't work and gave following error-
java.lang.NullPointerException: Cannot get property 'version' on null object
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
