1. Create settings.gradle file with the following content:

    rootProject.name = 'download-dependecies'
  2. Create build.gradle file with the following content:

    plugins {
        id 'application'
    }
    
    group 'xyz.ronella.gradle'
    version '1.0.0'
    
    repositories {
        mavenCentral()
    }
    
    dependencies {
        //Add all the target dependencies here
        implementation 'org.apache.poi:poi:3.5-FINAL'
    }
    
    task download(group: 'resolver') {
        doFirst {
            ant.delete(dir: 'libs')
            ant.mkdir(dir: 'libs')
        }
        doLast {
            copy {
                from sourceSets.main.runtimeClasspath
                into 'libs/'
            }
            def outputFile = "${project.buildDir}\\${project.name}-${version}.zip"
            ant.zip(basedir: "${file('libs')}", destfile: "${outputFile}", excludes: '*.class')
            println "Output: ${outputFile}"
            ant.delete(dir: 'libs')
        }
    }
  3. Run the following gradle command:

    gradle download

    If you are using the gradle wrapper, use the following command:

    gradlew download