Gradle Exec, could not fine method error, what am I doing wrong?

I’m trying to execute custom tool with gradle exec task like this:

task specflowClassGeneration << {

exec { executable = “…\specflow\tools\specflow.exe” args = [“generateall”, “ABZ.ReportFactory.OfficeAddin.FunctionalTests.Excel\ABZ.ReportFactory.OfficeAddin.FunctionalTests.Excel.csproj”, “/force”] } }

But I’m getting this error:

Execution failed for task ‘:specflowClassGeneration’. > Could not find method …\specflow\tools\specflow.exe() for arguments [[generateall, ABZ.ReportFactory.OfficeAddin.FunctionalTests.Excel\ABZ.ReportFactory.OfficeAddin.FunctionalTests.Excel.csproj, /force]] on root project ‘ABZ ReportFactory Office Addin’.

When I type in command line this command it executes normally:

…\specflow\tools\specflow.exe generateall “ABZ.ReportFactory.OfficeAddin.FunctionalTest.Excel\ABZ.ReportFactory.OfficeAddin.FunctionalTest.Excel.csproj” /force

What am I doing wrong?

You probably have a syntax error somewhere. Usage of ‘code’ tags would make your post easier to read.

Well, I don’t see any syntax errors. Is there some more parameter to specify for this to work?

For example, those two lines are same, only difference is that is first one is using commandLine, and second one executable.

exec { commandLine = ["..\specflow\tools\specflow.exe", "generateall", "ABZ.ReportFactory.OfficeAddin.FunctionalTests.Excel\ABZ.ReportFactory.OfficeAddin.FunctionalTests.Excel.csproj", "/force"] }
exec { executable = "..\specflow\tools\specflow.exe" args = ["generateall", "ABZ.ReportFactory.OfficeAddin.FunctionalTests.Excel\ABZ.ReportFactory.OfficeAddin.FunctionalTests.Excel.csproj", "/force"] }

Second snippet misses a semi-colon or newline before ‘args’.

Thanks a lot. :slight_smile: I didn’t know that semi-colon is required there. :slight_smile: