In our company we wrote custom gradle plugin which is doing some stuff when application plugin is present. But when application plugin is included in build.gradle after our plugin, our plugin doesn't discover application plugin and actions are not executed.
Is there any way in gradle to enforce plugin applying order? Or any other solution?
Small excerpt from our plugin:
void apply(Project project) {
if (project.plugins.hasPlugin(ApplicationPlugin) {
//some stuff, doesn't work if "application" appears after this plugin
}
}
According to this thread on the Gradle forums, withType(Class)
and withId(String)
are lazily evaluated and only applied when the referenced plugin is applied.
void apply(Project project) {
project.plugins.withType(ApplicationPlugin) {
//some stuff, doesn't work if "application" appears after this plugin
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With