Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle does nothing on distZip task from distribution plugin

I have a Problem with the distribution Plugin of Gradle. I just want to use the plugin to bundle all my files together (jar's, shell-scripts, ...).

Here 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 the output:

$ ./gradlew distTar
Defaulting memory setting '-Xmx1024M'...
:distZip UP-TO-DATE

BUILD SUCCESSFUL

Total time: 2.44 secs

And nothing happens. No Zip File is created. I'm using the latest version of Gradle (2.2.1)

Important for me is also, that I can use the installDist option of the plugin.

Any Ideas what's going wrong?

like image 782
guenther Avatar asked Feb 11 '15 14:02

guenther


1 Answers

I found out what the Problem was:

The distZip wasn't working, because there were no files or libraries configured to be packed into the archive. By default, only the src/$distribution.name/dist is considered. The rest must be specified.

To ensure that at least the jar-File of the project is contained too, I used the plugin "java-library-distribution" instead of "distribution"

Furthermore I specified more files to consider:

distributions {
    main {
        contents {
            from { 'distrib' }
        }
    }
}
like image 82
guenther Avatar answered Sep 28 '22 11:09

guenther