This message was deleted.
# community-support
s
This message was deleted.
1
f
In short, I have a task that I always want to run after a specific type of task
v
No, overriding it makes no sense. You are expected to call it
And don't filter tasks like that, that would eagerly realize all tasks and totally go against task configuration avoidance.
mustRunAfter(getProject().getTasks().withType(Jar.class))
1
That's then also lazy, catching jar tasks registered later after you made that call
1
f
From where do I call it? From within the Taskaction or from the plugin where I create the task?
I would guess the plugin? 😄
So something like
Copy code
var qp = project.getTasks().create(QPTask.create(GROUP_NAME));
qp.mustRunAfter(project.getTasks().withType(Jar.class));
Seems to work, thanks @Vampire
v
From the plugin is a good place, yes. You could also do it for example from the constructor of the task. But it is more idiomatic to not have opinon (like these orderings or also default values) within tasks and extensions, but have them as unopinionated as possible and add the opinion by the plugin adding them. This way they can also more easily be used for a different purpose.