Home > Net >  Gradle 7: How to create folders in ZIP task?
Gradle 7: How to create folders in ZIP task?

Time:12-14

I try to create zip-task in Gradle 7 and I want to have different folders for different files.

task myZipTask(type: Zip) {
    from 'first/source'
    into 'firstFolderInsideZipFile'

    from 'second/source'
    into 'secondFolderInsideZipFile'
}

It obviously doesn't work like this, but is there a way to implement it?

CodePudding user response:

You should be able to do something like this:

plugins {
    id 'java'
}
task myZipTask(type: Zip) {
    from('first/source') {
        into('firstFolderInsideZipFile')
    }
    from('second/source') {
        into('secondFolderInsideZipFile')
    }
}
  • Related