Gradle Goodness: Unpacking an Archive
To create an archive with Gradle is easy. We have several tasks like Zip, Tar, Jar, War and Ear to create a new archive. But there is no UnZip or UnTar to unpack an archive in Gradle. To unpack an archive we must use the Copy task and copy the contents of the archive to a specified destination directory. In Gradle we can use the zipTree() method to access the contents of an archive. So in our copy definition the source is the contents of the archive we access with the zipTree() method.
In the following build file we see a simple task to unzip a ZIP file with the name dist.zip in the directory src/dists. We unpack the contents to the directory build/unpacked/dist:
0.task unzip(type: Copy) {1.def zipFile = file('src/dists/dist.zip')2.def outputDir = file("${buildDir}/unpacked/dist")3. 4.from zipTree(zipFile)5.into outputDir6.}The good thing is that tasks of type Copy automatically support Gradle's incremental build support. This means that if the task has been executed once and the dist.zip file and output in the directory build/unpacked/dist has not change the task is up-to-date and isn't executed.
We get the following output if we run the task twice:
$ gradle unzip:unzipBUILD SUCCESSFULTotal time: 2.867 secsunzip mrhaki$ gradle unzip:unzip UP-TO-DATEBUILD SUCCESSFULTotal time: 2.606 secs$Gradle Goodness: Unpacking an Archive的更多相关文章
- Gradle Goodness: Copy Files with Filtering
Gradle Goodness: Copy Files with Filtering Gradle's copy task is very powerful and includes filterin ...
- 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. ...
- yum update 执行报错: error : unpacking of archive failed on file /usr/.../...;5d26ff7c: cpio : symlink
早前已发现有台机一直在报这么个错误, 一用yum update 就报一堆: Error: unpacking rpm package ..... error: xxxx : install faile ...
- Gradle Goodness: Adding Tasks to a Predefined Group
In Gradle we can group related tasks using the group property of a task. We provide the name of our ...
- Gradle Goodness: Using and Working with Gradle Version
To get the current Gradle version we can use the gradleVersion property of the Gradle object. This r ...
- Gradle Goodness: Skip Building Project Dependencies
If we use Gradle in a multi-module project we can define project dependencies between modules. Gradl ...
- Gradle Goodness: Continue Build Even with Failed Tasks
If we run a Gradle build and one of the tasks fails, the whole build stops immediately. So we have f ...
- Gradle Goodness: Rename Ant Task Names When Importing Ant Build File
Migrating from Ant to Gradle is very easy with the importBuild method from AntBuilder. We only have ...
随机推荐
- JAVA版-微信高清语音.speex转.wav格式
功能介绍: PC端将.speex文件解码为*.wav文件 使用场景: 在MAC/Linux下Java JNI 调用C Speex,后端Java处理微信服务器下载下来的微信高清语音.speex解码为.w ...
- 给tomcat7w.exe改名字
在平常使用tomcat的过程中,经常会在自己的电脑上安装两个tomcat,而且使用tomcat的tomcat7w.exe界面比较方便,即 但是两个tomcat的名字一样,也只能启动一个tomcat. ...
- easy html+css tree 简单的HTML+css导航树
code: show:
- Django—XSS及CSRF
一.XSS 跨站脚本攻击(Cross Site Scripting),为不和层叠样式表(Cascading Style Sheets, CSS)的缩写混淆,故将跨站脚本攻击缩写为XSS.恶意攻击者往W ...
- 24_BlockingQueue接口
[BlockingQueue常见] [ ArrayBlockingQueue ] 基于数组的阻塞队列的实现,在ArrayBlockingQueue内部,维护了一个定长数组,以便缓存队列中的数据对象,其 ...
- 第三次scrum作业!
1.小组成员 舒 溢 许嘉荣 唐 浩 黄欣欣 廖帅元 刘洋江 薛思汝 2.个人在小组第三次冲刺任务及其完成情况描述 根据小组讨论所分配任务,积极辅助组长以及各个成员,理清思路,编写代码,尽量在规定时间 ...
- MapReduce优化参数
资源相关参数 //以下参数是在用户自己的 MapReduce 应用程序中配置就可以生效 (1) mapreduce.map.memory.mb: 一个 Map Task 可使用的内存上限(单位:MB) ...
- request.getRequestDispatcher().forward(request.response)
request.getRequestDispatcher().forward(request.response)中的那两个参数是哪里来的? 2010-11-09 23:13 QQ357169111 | ...
- mongoDb 命令
1.显示MongoDB的服务器统计:db.stats() 2.创建数据库:use dbname 3.删除数据库:db.dropDatabase() 4.检查当前选择的数据库:db 5.检查数据库列表: ...
- vscode:解决操作git总让输入用户名及密码问题
只要是使用git操作,不管是同步,拉去,克隆,vscode总让我们输入用户名及密码,是一件很繁琐的事情 我们打开终端,会看到cmd定位在我们仓库位置,我们只要添加:git config --globa ...