Unable to exclude directory/file from clean


(Sathyakumar Seshachalam) #1

Also in Exclude directories in clean task

Trying to exclude directories in clean

clean {
excludes ‘/appFolder/
}

But I get this error now.

Could not find method excludes() for arguments [/appFolder/] on project.

And just to be sure that I can do any customization with clean at all tried.

clean {
delete “new/file”
}

And this works.


(Mark Vieira) #2

By default the ‘clean’ task simply deletes the build directory. There is some directory under build that you don’t want to be deleted? There is no way to define excludes for Delete tasks. What you can do is reconfigure the ‘clean’ task.

clean {
    delete = [] //clear out existing files to delete
    delete 'dir', 'someotherdir', 'somefile.txt'
}

(Sathyakumar Seshachalam) #3

Ok, Thanks,

I suppose sometime back this was possible (around 2013 whatever the version was then). As it was pointed out then in the discussion forum.


(siva) #4

Hi mark,
If I reconfigure the ‘clean’ task as below,
clean {
delete = []
}
It is excluding all the files in the build directory.

I would like to exclude some dependency jars from clean(https://github.com/pndaproject/platform-gobblin-modules/blob/develop/build.gradle#L48).

Have tried as bellow, but no luck.
clean {
delete ‘kite-data-core-1.1.0.jar’
}
Please let me know, if I missed anything.