build.gradle - How do I extend gradle's clean task to delete a file? -


so far i've added following build.gradle

apply plugin: 'base'  clean << {     delete '${rootdir}/api-library/auto-generated-classes/'     println '${rootdir}/api-library/auto-generated-classes/' } 

however not file not deleted, print statement shows ${rootdir} not being converted root directory of project. why won't work, concepts missing?

you need use double quotes. also, drop << , use dofirst instead if planning deletion during execution. this:

clean.dofirst {     delete "${rootdir}/api-library/auto-generated-classes/"     println "${rootdir}/api-library/auto-generated-classes/" } 

gradle build scripts written in groovy dsl. in groovy need use double quotes string interpolation (when using ${} placeholders). take @ here.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -