Gradle Goodness: Skip Building Project Dependencies
If we use Gradle in a multi-module project we can define project dependencies between modules. Gradle uses the information from the project dependencies to determine which tasks need to be run. For example if module B depends on module A and we want to build module B, Gradle will also build module A for us, because module B depends on it. But if we know for sure that module A is up to date and has not changed, we can also instruct Gradle to skip building module A, when we build module B.
Let's start with the following module structure, where each module depends on the module above it. So module services depends on common and module web depends on services:
.├── common├── services└── webWhen we want to build the service module we go to the services directory and execute the build task and we get the following output:
$ gradle build:common:compileJava :common:processResources :common:classes :common:jar :services:compileJava :services:processResources :services:classes :services:jar :services:assemble :services:compileTestJava :services:processTestResources :services:testClasses :services:test :services:check :services:build BUILD SUCCESSFULTotal time: 8.013 secsWe see in the output that first the common module is build, because the services module depends on it. But if we work on this project and we know for sure the common module is up to date and has not changed since the last build (for example we didn't checkout new sources from version control or changed sources in the common module ourselves), then we can skip building the common module. We use the command line option -a or --no-rebuild to tell Gradle to skip project dependencies.
When we run the build task from the services directory using the command line option -a we get the following output:
$ gradle -a build:services:compileJava :services:processResources :services:classes :services:jar :services:assemble :services:compileTestJava :services:processTestResources :services:testClasses :services:test :services:check :services:build BUILD SUCCESSFULTotal time: 5.626 secsThis time only the services module is build, which also speeds up the build proces. Still this should only be used if we know ourselves the project dependencies are up to date.
Written with Gradle 2.2.1.
Gradle Goodness: Skip Building Project Dependencies的更多相关文章
- Windows下Android Studio长时间停留在Building "Project Name" Gradle project info画面的解决方法
问题描述: 创建好一个Android项目后,Android Studio长时间停留在Building [Project Name] Gradle project info画面不动. 原因: 此时And ...
- AndroidStudio创建项目时一直处于building“project name”gradle project info的解决办法
AndroidStudio创建项目,最后一步finish后,一直长时间处于building“project name”gradle project info,界面就一直停留在如图所示: 谷歌自家的产品 ...
- Android Studio 创建/打开项目时一直处于Building“project name”Gradle project info 的解决
最近发现新版的AS,IDEA毛病不断,而且gradle的更新又给墙了,无奈啊! 进入类似如下的目录,发现如果没有对应的gradle解压文件,则在gradle官网下载完整压缩包,放入类似55xxxx串号 ...
- Android Studio一直显示Building“project name”Gradle project info问题详解
关注我,每天都有优质技术文章推送,工作,学习累了的时候放松一下自己. 本篇文章同步微信公众号 欢迎大家关注我的微信公众号:「醉翁猫咪」 Android Studio一直显示 Building&quo ...
- Gradle Goodness: Display Available Tasks
To see which tasks are available for our build we can run Gradle with the command-line option -t or ...
- Gradle Goodness: Task Output Annotations Create Directory Automatically
Gradle Goodness: Task Output Annotations Create Directory Automatically One of the great features of ...
- Gradle Goodness: Init Script for Adding Extra Plugins to Existing Projects
Gradle Goodness: Init Script for Adding Extra Plugins to Existing Projects Gradle is very flexible. ...
- Gradle Goodness: Copy Files with Filtering
Gradle Goodness: Copy Files with Filtering Gradle's copy task is very powerful and includes filterin ...
- Gradle Goodness: Check Task Dependencies With a Dry Run
We can run a Gradle build without any of the task actions being executed. This is a so-called dry ru ...
随机推荐
- zookeeper的一些异常总结
1.Could not find the main class: org.apache.zookeeper.server.quorum.QuorumPeerMain. Program will ex ...
- AngularJS与RequireJS集成方案
关于angularjs.requirejs的基础知识请自行学习 一.简单事例的项目目录如下: -index.html -scripts文件夹 --controller文件夹 --- mianContr ...
- 推荐:一个个人开发者搞app赚钱之后的总结!有图有真相。
2011年已经过去了,回顾2011有收获,更有许多不足.收获就是了却了一件人生大事(女儿出生),还有就是算入门了android并利用它开发 了一 款还算有些许收获的应用.不足的地方是单位工作上没有太好 ...
- [转]HTTPS那些事(一)HTTPS原理
[转]HTTPS那些事(一)HTTPS原理 http://www.guokr.com/post/114121/ 楔子谣言粉碎机前些日子发布的<用公共WiFi上网会危害银行账户安全吗?>, ...
- [转]unzip解压windows zip乱码的处理
[转]unzip解压windows zip乱码的处理 http://blog.sina.com.cn/s/blog_6c9d65a101012gz0.html 朋友从windows传过来的zip文件, ...
- Python实现SVM(支持向量机)
Python实现SVM(支持向量机) 运行环境 Pyhton3 numpy(科学计算包) matplotlib(画图所需,不画图可不必) 计算过程 st=>start: 开始 e=>end ...
- 一、JPEG文件格式-----压缩框架
JPEG文件格式 http://wenku.baidu.com/view/4856d31dc281e53a5802ff0d.html 标记名 FF E0 ...
- JAVA素数分解
package test; import java.util.*; public class test1 { public static void main(String[] args){ long ...
- jQuery图片无缝轮播插件;
图片轮播这种效果在web开发中看常见,网上的插件也有很多,最近在整理项目的过程中,把之前的图片轮播效果整合了一下,整理成一个可调用的插件以做记录,也方便更多前端爱好者来学习使用:图片的轮播原理很简单, ...
- Shell采集系统cpu 内存 磁盘 网络信息
cpu信息采集 cpu使用率 采集算法 通过/proc/stat文件采集并计算CPU总使用率或者单个核使用率.以cpu0为例,算法如下: 1. cat /proc/stat | grep ‘cpu0’ ...