Creating a database via gradle


(Marcelo Correa) #1

Hi there,

a newbie question,
how to manage redirections on a task?
I think the problem lies on quoting the command.
I have this to setup my test enviroment

task setupDBTest(type:Exec, description: 'Setting up test database') {
    workingDir 'docs/'
    commandLine 'mysql', '-udbuser', '-pdbuser < dbTest.sql'
}

but I am unable to make it run :frowning:

any help is welcome
regards,
Marcelo


(Marcelo Correa) #2

a few hours latter…
with help from post How to achive bash like functionality (e.g. 'ls | grep mystuff') with gradle project.exec?

task setupDBTest(type:Exec, description: 'Setting up test database') {
    workingDir 'docs/'
    commandLine "sh", "-c", "mysql -u dbuser -pdbuser < dbTest.sql"
}

now working :slight_smile: