I have to write plugin to copy specific dependecies and extract config files inside those dependecies to directory

I am good in java but not in groovy and new to gradle ( learning), Doing POC in gradle
Please help me on how to write java plugin for the below tasks:

  1. copy Specific Dependecies jars
  2. Extract Config or Resources files in specific dependecies to directory
  3. zip the step 2
  4. Create final deployemnt structure for application.

Please help me to write this

You can create task as you wish by using Zip type task, without creating a plugin.

For example, the task, which copies junit excluding hamcrest jar and MANIFEST.MF file, can be written as follows.

configurations {
    junitDep
}
dependencies {
    junitDep 'junit:junit:4.12'
}

task copyOnlyJunit(type: Zip) {
    from configurations.junitDep.findAll{file ->
        !file.name.contains('hamcrest')
    }.collect {file ->
        zipTree(file)
    }
    exclude '**/manifest.mf'
    caseSensitive = false
    baseName = 'only-junit'
}

This task will copy and archive files from junit excluding hamcrest and manifest.mf file into build/distribution/only-junit.zip file.

Detail information is available at Gradle DSL Document on Zip.

You might want to use the [shadow plugin] (https://github.com/johnrengelman/shadow)

Thanks for the quick reply . It really Helps :grinning: