Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle Distribution Task Output Files Not at Root of ZIP

I created a simple Gradle build that exports the contents of ./src/main/groovy to a zip file. The zip file contains a folder with the exact same name as the zip file. I cannot figure out how to get the files into the root of the zip file using the distribution plugin.

i.e. gradlew clean distZip produces:

helloDistribution-1.0.zip -> helloDistribution-1.0 -> files

what I would like:

helloDistribution-1.0.zip -> files

My build.gradle file:

apply plugin: 'groovy'
apply plugin: 'distribution'

version = '1.0'

distributions {
    main {
        contents {
            from {
                'src/main/groovy'
            }
        }
    }
}

I have attempted to fix the problem by adding into { 'dir' } but to no avail.

like image 717
mark Avatar asked Jun 30 '14 18:06

mark


1 Answers

Using into '/' seems to do the trick:

contents {
    from {
        'src/main/groovy'
    }
    into '/'
}
like image 113
penfold Avatar answered Sep 18 '22 18:09

penfold