Yong_Cheng
(Yong Cheng)
January 28, 2014, 2:53am
1
Issued:
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':clean'.
my build.gradle is the same from grails-gradle-plugin ( inside project description - README.md)
Same issue posted on Github: https://github.com/grails/grails-gradle-plugin/issues/58
Things tried to make it work: Commented line 33: to disable the dependencies
project.tasks.getByName(BasePlugin.CLEAN_TASK_NAME).dependsOn grailsClean
on follow file: https://github.com/grails/grails-gradle-plugin/blob/master/src/main/groovy/org/grails/gradle/plugin/tasks/GrailsTaskConfigurator.groovy
Don’t know if this is a issue for base plugin or something else.
Looking forward to hear back from someone Thanks in advance Yong
It’s very unlikely a Gradle issue. Looking at the file you linked to, the task name is ‘grails-clean’, not ‘grailsClean’.
Yong_Cheng
(Yong Cheng)
January 28, 2014, 3:11am
3
Peter, grailsClean is a ref to the task. And this dependsOn is happening not thought a build.gradle file.
def grailsClean = project.tasks.create(GRAILS_CLEAN_TASK, GrailsTask).with {
command = "clean"
description = 'Executes Grails clean'
}
project.tasks.getByName(BasePlugin.CLEAN_TASK_NAME).dependsOn grailsClean
And more interesting, I tried to changed to following:
project.tasks.getByName(BasePlugin.CLEAN_TASK_NAME).dependsOn grailsClean 'grails-clean'
It works, and why can not dependsOn a task variable?
So interesting…
The way your code uses ‘with’, the ‘grailsClean’ variable will contain the string ‘‘Executes Grails clean’’, rather than the task instance. This could be fixed by adding ‘it’ as the last statement of the closure, but it’s better to either use an overload of ‘create’ that accepts a configuration closure, or to use ‘project.configure’.
Yong_Cheng
(Yong Cheng)
January 28, 2014, 3:38am
5
Oh, that’s why, thank you, Peter.