Reputation: 344
I started reading the gradle user guide and tried to reproduce what is done there. So i created a file "build.gradle" and put it in here: "c:\development\build.gradle".
That file includes the following text:
task compile << {
println 'compiling source'
}
task compileTest(dependsOn: compile) << {
println 'compiling unit tests'
}
task test(dependsOn: [compile, compileTest]) << {
println 'running unit tests'
}
task dist(dependsOn: [compile, test]) << {
println 'building the distribution'
}
Now I opened a Windows command windows and typed in this:
gradle -b C:\development\build.gradle dist test
This is what I got:
FAILURE: Build failed with an exception.
Where: Build file 'C:\development\build.gradle' line: 1
What went wrong: A problem occurred evaluating root project 'development'.
Could not find property 'compile' on root project 'development'.
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
After some tries I found, that the file itself was been found, but I don't know why it is not executed. What am I doing wrong?
Upvotes: 0
Views: 140
Reputation: 344
I found the solution by myself.
Make sure, that your build file has the same encoding as your operating system. In my case I created a UTF-8 file, but should have been an ISO-file.
After changing to the correct encoding, everything works fine.
Upvotes: 1