Usually, ‘export’ is a built-in shell command, and it doesn’t make sense to run it on its own. The error you get is for a different reason, namely that ‘args’ is a list of arguments. Either leave off the ‘=’, or use ‘args = [ … ]’.
Thank you Peter. However, your solutions doesn’t work. I am still getting the same error with (args ‘CONTROLLER_HOST=host’) or (args = [‘CONTROLLER_HOST=host’]). your help is much appreciated.
So, i end up doing as following: task importHost(type:Exec) {
executable “bash”
args “-c”, “export”, “CONTROLLER_HOST=host”
}
Peter, when you said ‘export is a built-in shell command, and it doesn’t make sense to run it on its own’, did you mean that the ‘export’ is run as a separate child process, so exporting any variables wouldn’t be available in the parent where gradle is executing so its worthless, correct? If so, how do we import Env variables with gradle, so they are available in the parent process? Thank YOu