java - Add Task dependency to existing Plugin Task in Gradle? -
i include second gradle file my.gradle
in build.gradle
file.
the content of my.gradle
is:
apply plugin: myplugin
class myplugin implements plugin<project> { @override void apply(project project) { project.tasks.create(name: "mytask", type: mytaskclass) { } } }
in build.gradle
set @ top:
apply from: 'myplugin.gradle'
now want set task dependency in build.gradle
with:
tasks.myplugin.mytask.dependson += someothertask
when build following error:
> not find property 'myplugin' on task set.
how can access mytask
myplugin
in build.gradle
?
edit: tried make sure sometask runs after mytask. tried with:
taskx.finalizedby tasky
in case:
tasks.myplugin.mytask.finalizedby someothertask
but former not work.
the following script job:
my.gradle:
apply plugin: myplugin class myplugin implements plugin<project> { @override void apply(project project) { project.tasks.create(name: "mytask", type: copy) { } } }
build.gradle:
apply from: 'my.gradle' task someothertask << { println 'dolast' } project.tasks.mytask.dependson(someothertask)
Comments
Post a Comment