I need to start a groovy script during the gradle- run
-task after the compileGroovy
-task, in order to create some resources. Therefore I have made the following build.gradle
-file:
apply plugin: 'groovy'
apply plugin:'application'
repositories {
mavenCentral()
}
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.4.3'
}
task myTask << {
new GroovyShell().run(file('/src/someScript.groovy'))
}
myTask.mustRunAfter(compileGroovy)
myTask.dependsOn(compileGroovy)
Problem is: myTask
is never executed when I execute the run
-task.
How can I let myTask
be executed after compileGroovy
-task, which is nested inside run
-task?
Try adding:
compileGroovy.finalizedBy(myTask)
It should solve the problem.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.