java - How do set environment variable in gradle via task? -


i have gradle application. , main gradle-file include tasks (groovy). need when start task - environment variable "lang" set encoding = ru_ru.koi8-r (for windows, linux), , after completion of task - environment variable contains initial value (en_us.utf-8). how it? me, please.

as far know, cannot set system environment variable gradle task.

however possible set environment variable process. if need set environment variable build use this:

task mytask(type: exec) {   environment 'environment_variable_name', 'environment_variable_value'    // run or build code needs environment variable } 

you can make compile depend on task if build code set environment variable before compile:

tasks.withtype(javacompile) {   compiletask -> compiletask.dependson mytask } 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -