DarkMatter in Cyberspace
  • Home
  • Categories
  • Tags
  • Archives

Add Customized Files and Folders into Deployed Zip File Created by Gradle


Creating deployed zip file with gradle is very convenient. But what if I want to add some customized files and folders into this file?

According to Deploy additional files in Gradle Application Plugin, creat a "dist" folder under "src" in the root of project. Then everything under "dist" will be copied to zip file created by gradle distZip or gradle installApp.

$ pwd
/home/chad/docs/GDEP-0811
$ mkdir -p src/dist/plugins
$ echo "pwd" > src/dist/plugins/autocmd.sh
$ echo "config1: value1" > src/dist/dep.conf
$ tree src/dist
src/dist
├── dep.conf
└── plugins
    └── autocmd.sh
$ gradle clean installApp
$ tree build/install/gdep
build/install/gdep
├── bin
│   ├── gdep
│   └── gdep.bat
├── dep.conf
├── lib
│   ├── commons-configuration-1.10.jar
│   └── ...
└── plugins
    └── autocmd.sh
$ gradle clean distZip
$ unzip -l build/distributions/gdep-0.4.zip
Archive:  build/distributions/gdep-0.4.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  2014-11-19 15:35   gdep-0.4/
      132  2014-09-29 17:01   gdep-0.4/dep.conf
        0  2014-11-19 15:20   gdep-0.4/plugins/
        6  2014-11-19 15:13   gdep-0.4/plugins/autocmd.sh
        0  2014-11-19 15:35   gdep-0.4/lib/
     7255  2014-11-19 15:35   gdep-0.4/lib/gdep-0.4.jar
    76643  2014-08-14 08:40   gdep-0.4/lib/...
        0  2014-11-19 15:35   gdep-0.4/bin/
     5369  2014-11-19 15:35   gdep-0.4/bin/gdep
     2727  2014-11-19 15:35   gdep-0.4/bin/gdep.bat
---------                     -------
  2180116                     20 files

Here the file "dep.conf" and folder "plugins" is copied directly from $PROJ_ROOT/src/dist.



Published

Nov 19, 2014

Last Updated

Nov 19, 2014

Category

Tech

Tags

  • customize 5
  • gradle 11

Contact

  • Powered by Pelican. Theme: Elegant by Talha Mansoor