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 ...
随机推荐
- 在CentOS 7下更改yum源与更新系统
在CentOS 7下更改yum源与更新系统. [1] 首先备份/etc/yum.repos.d/CentOS-Base.repo cp /etc/yum.repos.d/CentOS-Base.rep ...
- csharp:Microsoft.Ink 手写识别(HandWriting Recognition)
/* 下載: //Microsoft Windows XP Tablet PC Edition 2005 Recognizer Pack http://www.microsoft.com/zh-cn/ ...
- Python-常用模块1
今天我们来看一看python中的常用的模块,内容有点多,我会分两天来更新这些知识 一.什么是模块 模块就是我们把装有特定功能的代码就行归类的结果,从代码编写的单位来看我们的程序,从小到大的顺序:一条代 ...
- 【Android】10.0 UI开发——如何编写程序界面、常见控件的使用
************************ 转载请注明出处:https://www.cnblogs.com/xiaofu007/p/10331880.html ***************** ...
- <head>标签和它的小伙伴们
head标签是HTML文档中最基本的必须元素之一(body:对,还有我): <html> <head> <title>文档的标题</title> < ...
- Element和vue框架报错提示
上面报错提示Error in render function: "TypeError:Cannot read property '$options' of undefined" 就 ...
- c# 读取txt文件并分隔
public static List<PostPerson> GetNameByFile() { #region 读取txt文件 var file = File.Open(Environm ...
- iptables 安全
注解:来自某位大神的详解,做个笔记. iptables防火墙简介 Netfilter/Iptables(以下简称Iptables)是unix/linux自带的一款优秀且开放源代码的安全自由的**基于包 ...
- Android中如何在Eclipse中关联源代码?(图文)
关联源代码 1.删除工程里面的Android Depandencies,删除后会报错,不要理会.看下面 2.添加libs目录下的Android-support-v4.jar包 选中-->右键-- ...
- MUI实现上拉加载和下拉刷新
编写存储过程分页(此处使用T-SQL) CREATE PROC [dbo].[Common_PageList] ( @tab nvarchar(max),---表名 @strFld nvarchar( ...