How can I conditionally run code if a Gradle plugin is applied? -
i have script plugin to:
- check if
ivy-publish
applied (viaapply plugin: ivy-publish
): - if applied, declare
publishing { repositories { ivy { } } }
- if it's not applied, run other code
however, i'm unsure of how run code if ivy-publish
plugin applied, , couldn't find in documentation. there way this?
you can use pluginmanager.withplugin(string id, action<? super appliedplugin> action
) method. javadoc:
if plugin specified id has been applied, supplied action executed immediately. otherwise, action executed after plugin specified id applied.
in build script like:
pluginmanager.withplugin('ivy-publish') { // configuration }
Comments
Post a Comment