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
Post a Comment