摇篮排除插件为特定的子项目主项目(S) [英] Gradle exclude plugin in main project for specific subproject(s)

查看:260
本文介绍了摇篮排除插件为特定的子项目主项目(S)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作,包含许多子项目都是建立与摇篮一个更大的项目。 一般来说,所有的项目都是Java项目,因此在主build.gradle脚本

I am working on a larger project that contains many subprojects which are all build with gradle. Generally all projects are java projects, therefore in the main build.gradle script

allprojects {
    apply plugin: 'java'
}

被指定为所有项目。

is specified for all projects.

不过,我需要或者删除插件的项目有一定的子树或明确从插件中排除的项目。

However I need to either remove the plugin for a certain subtree of projects or explicitly exclude the the projects from the plugin.

的项目布局继承人一个粗略概述

Heres a rough overview of the project layout

+ Main
+-- javaApplications
+-- javaLibs
+-- Android
+-----AndroidApps
+-----AndroidLibs

安卓/ *不需要Java插件。 什么是实现这一目标的最佳解决方案?注:我不能改变项目结构

Android/* does not need the java plugin. What is the best solution to achieve this? Note: I cannot change the project structure.

推荐答案

这应该可以解决问题(当放置在根 build.gradle 脚本)

This should do the trick (when placed in root build.gradle script)

configure(allprojects - project(':Android')) { //or ':Android:AndroidApps' not sure
    println "applying java plugin to $project"
    apply plugin: 'java'  
}

这篇关于摇篮排除插件为特定的子项目主项目(S)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆