The copy specification in Gradle copies the contents of a folder if the specified path in from is a folder.
One solution is to specify the target folder in the jar using the into directive .
processResources { from 'data' from 'publicFolder' } task data(type: Copy) { from 'data' into 'data' } task publicFolder(type: Copy) { from 'public' into 'public' }
This will place the contents or source folders in a folder with the same name in the bank. But, as you can see, you will need to repeat the folder names inside the into closure.
Another workaround is to have a parent folder for these resource folders and use that parent folder in the copy specification.
Here you can structure the resource folders:
<project-folder> | --> res | --> public --> data
Then in copy spec processResources you can do the following:
processResources { from 'res' }
This will create the public and data folders in the last jar file as you want.
Invisible Arrow
source share