How to apply a Gradle plugin from another plugin?

后端 未结 2 1092
被撕碎了的回忆
被撕碎了的回忆 2021-02-08 08:42

I\'m trying to encapsulate android plugin in my own plugin, but when I\'m trying to apply my plugin build fails with an exception:

A problem occurred evaluating          


        
2条回答
  •  北海茫月
    2021-02-08 08:46

    Use the project's PluginManager. For example, the war plugin pulls in the java plugin like this:

    public class WarPlugin implements Plugin {
        // ...
        public void apply(final Project project) {
            project.getPluginManager().apply(org.gradle.api.plugins.JavaPlugin.class);
            // ...
        }
        // ...
    }
    

提交回复
热议问题