Not able to read in jenkins pipeline job

i am running jenkins pipeline job with gradle. I have a requirement to get the the property value mentioned the, how can i get it


  • Use Jenkins declarative pipeline built-in readFile() to read files from the workspace.

    Let's say your contains


    To read the version property from the file do this in your Jenkinsfile:

    pipeline {
        stages {
            stage("read file from workspace") {
                steps {
                    checkout scm
                    script {
                        String content = readFile("")
                        Properties properties = new Properties()
                        properties.load(new StringReader(content))
                        echo "property 'version' has value '${properties.version}'"

    This might fail when executed due to missing permission to execute arbitrary code, depending on your Jenkins setup. You'll may receive errors like this:

    Scripts not permitted to use method java.util.Properties load Administrators can decide whether to approve or reject this signature.

    Read more about this topic here: Script Approvals.

    Once approved, the property can be read in:

    [Pipeline] readFile
    [Pipeline] echo
    20:55:16 property 'version' has value '1.2.3-SNAPSHOT'