martosoler
(Leandro Martin Soler)
March 30, 2016, 2:56am
1
I’m trying to execute the following snippet in order to unzip the Postgres tar file:
task unzipPostgres(type: Exec) { commandLine 'tar' '-xf' 'postgres/postgresql.tar.bz2' }
But the task fails with:
Caused by: org.gradle.api.internal.MissingMethodException: Could not find method -xf() for arguments [postgres/postgresql.tar.bz2] on task ':postgres:unzipPostgres'.
I have tried many ways, with executable
, with args
but none seems to work.
Could somebody help me?
sterling
(Sterling Greene)
March 30, 2016, 4:01am
2
You’re missing commas, so it’s trying to interpret it like…
commandLine('tar', -xf('postgres/postgresql.tar.bz2'))
You can fix it:
task unzipPostgres(type: Exec) {
commandLine 'tar', '-xf', 'postgres/postgresql.tar.bz2'
}
commandLine is just a method: https://docs.gradle.org/current/dsl/org.gradle.api.tasks.Exec.html#org.gradle.api.tasks.Exec:commandLine(java.lang.Iterable)
martosoler
(Leandro Martin Soler)
March 31, 2016, 5:19pm
3
Thank you very much !! It works with the commas