Gradle does nothing on distZip task from distribution plugin

I have a problem with the Gradle distribution plugin. I just want to use the plugin to merge all my files (jar's, shell-scripts, ...).

Here is my build.gradle:

apply plugin: 'eclipse' apply plugin: 'maven-publish' apply plugin: 'distribution' sourceCompatibility = 1.7 targetCompatibility = 1.7 publishing { ... } repositories { mavenCentral() } dependencies { // public libraries compile group: 'javax', name: 'javaee-api', version: '7.0' compile group: 'javax.mail', name: 'javax.mail-api', version: '1.5.2' compile group: 'commons-cli', name: 'commons-cli', version: '1.2' compile group: 'org.apache.axis', name: 'axis', version: '1.4' compile group: 'org.apache.axis', name: 'axis-jaxrpc', version: '1.4' compile group: 'commons-discovery', name: 'commons-discovery', version: '0.4' compile group: 'commons-logging', name: 'commons-logging', version: '1.1.1' compile group: 'wsdl4j', name: 'wsdl4j', version: '1.6.2' compile group: 'javax.xml.soap', name: 'saaj-api', version: '1.3' compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.10' runtime group: 'ch.qos.logback', name: 'logback-classic', version: '1.1.2' // this is a dirty workaround // because I don't have deploy rights on artifactory and nobody has time for deploying my artifacts compile fileTree(dir: 'lib', include: '*.jar') } 

Here's the conclusion:

 $ ./gradlew distTar Defaulting memory setting '-Xmx1024M'... :distZip UP-TO-DATE BUILD SUCCESSFUL Total time: 2.44 secs 

And nothing happens. No zip file. I am using the latest version of Gradle (2.2.1)

It is also important for me that I can use the installDist option for the plugin.

Any ideas what goes wrong?

+5
source share
2 answers

I found out what the problem is: The distZip file did not work because there were no files or libraries configured to pack into the archive. By default, only "src / $ distribution.name / dist" is considered. The rest should be indicated.

To ensure that at least the jar file of the project file is also included, I used the plugin "java-library-distribution" instead of "distribution"

In addition, I indicated more files:

 distributions { main { contents { from { 'distrib' } } } } 
+4
source

If your $buildDir empty, you need to configure the distribution:

 distributions { main { baseName = 'someName' contents { from { 'src/readme' } } } } 

Also see https://gradle.org/docs/current/userguide/distribution_plugin.html

+2
source

Source: https://habr.com/ru/post/1213144/


All Articles