Travis CI environment variables with Gradle properties

前端 未结 2 2160
攒了一身酷
攒了一身酷 2021-02-07 11:26

How can I use travis-ci env variables as Gradle\'s properties?

I locally have my gradle.properties under the gradle path having:

sonatypeRepo = abcd
         


        
2条回答
  •  深忆病人
    2021-02-07 12:20

    Below an example to define a project property, not a local variable, if it is not defined, by getting the value from the Environment.

    project.ext {
        if (! project.hasProperty('some_prop')) { 
            some_prop = System.getenv('some_prop') 
        }
    }
    

    I wanted a project property so I can use it also to set the PWs in my spring-boot YAML file... both locally and in CI.

提交回复
热议问题