Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle: Exclude distribution zip task from assemble

I'm using the distribution plugin. When I run a gradle build, which depends on gradle assemble, both distTar and distZip are triggered, and I end up with both a tarball and a zip file of my distribution. I only need a tarball. running both is time and space consuming (the project distribution is very large).

What would be a clean way to exclude distZip from a high level gradle build? I know I can use gradle build -x distZip but I want to run plain gradle build. I know dependencies can be excluded with build.dependsOn.remove(<name>) but I saw it described as not-recommended.

Thanks.

like image 961
Legato Avatar asked Aug 04 '15 10:08

Legato


2 Answers

You can try:

distZip.enabled = false
like image 109
Opal Avatar answered Oct 18 '22 14:10

Opal


One of our gradle builds has starting failing due to this issue. As mentioned by TmTom above the full solution was

task deleteZip {
    configurations.archives.artifacts.removeAll {it.file =~ 'zip'}
}

tasks.install.dependsOn(deleteZip)

If tars are also being troublesome add:

    configurations.archives.artifacts.removeAll {it.file =~ 'tar'}
like image 2
Dave Murray Avatar answered Oct 18 '22 13:10

Dave Murray