How to exclude file from changedetection

My сustom build task creates database with data file under buildDir, task has no outputs explicitly defined, however when I execute same task in next run, gradle tries to calculate changestate and fails because it has no access to generated database file which is currently in use. How can I exclude file form change detection?