Gradle Maven build plugin replacement

I am new to Gradle and am trying to port an existing Maven pom.xml that makes extensive use of the maven-assembly-plugin to generate various zip files.

In the example below, I get files from different subdirectories (with specific extensions) and then map them in a flat structure to a ZIP file.

task batchZip(type: Zip) {
  from fileTree('src/main/sas') {
    include('**/*.sas')
    include('**/*.ds')
  }.files
}

      

This puts all files in the zip root. However, ideally, I want the files to be under a specific path in the zip root, e.g. / Shared / SAS.

Is there a way to do this without copying all the files to a local directory and then zipping it?

+3


source to share


2 answers


task batchZip(type: Zip) {
    into('shared/sas') {
        from { fileTree('src/main/sas').files }
        include('**/*.sas')
        include('**/*.ds')
    }
}

      



+1


source


Take a look at the docs . It seems that if you specify a suitable one into

, you will get the result you are looking for.



+1


source







All Articles