11/09/2017, 8:57 AM
Hi. It seems I've already gotten answer for this newbie question but it's already behind the time horizon, I can't find it. What is the proper way to access existing tasks for configuring them? For example I want to add a spring profile when running application via gradle. Now I'm doing it like this:
val run: JavaExec by tasks
run.systemProperties[""] = "dev"
Second line is ok, but the first one looks like get any Task from map by name and cast it to JavaExec. Where is my strict typed model?) Or I want to run coberturaReport prior to test:
val test by tasks
val coberturaReport by tasks
Ok, no casts but still getting tasks from map by name.


11/09/2017, 9:01 AM
tasks.withType<JavaExec> {
	systemProperties[""] = "dev"


11/09/2017, 9:12 AM
And the second one can be something like this:
tasks.withType<GenerateReportTask> {
oh, vice versa
tasks.withType<Test> {
hm.. this doesn't work... Actually I'm a bit confused with the doc:
The coberturaReport task will cause instrumentation to happen before tests are run, and a coverage report to be generated after tests are run
What does it mean? Should I make test depends on coberturaReport? Or should I just enable somehow it, because there is something to do before tests and something -- after (Or maybe instrumentation will produce all reports). I'm still thinking in terms of maven's lifecycles and it spoils my gradle experience...