Search code examples
gradlegroovyenvironment-variablesbuild-process

Gradle-Writing env variable's value to manifest file


I am trying to read env variable "BUILD_NUMBER" from system variable and write to MANIFEST.MF .

Below is the gradle script .

war {
     doFirst {

        manifest {
            attributes("build-version": "$System.env.BUILD_NUMBER")
        }
    }
        archiveName 'APP007.war'
    }

The above script is creating attribute

"build-version"

but the value that is being written to the file is

"null"

.

I have created the env variable "BUILD_NUMBER" and the value that I have given is "APP007.2016.02".

Any idea why it is null ?

Thanks.


Solution

  • The above script started working after I restarted my system .Not deleting this since it may help others .