Your destinationDir is set to ${buildDir}/javadoc-public-html. The task creates this directory and writes Javadoc to it. Then the last thing you do is delete "${buildDir}/javadoc-public-html".
Therefore, the only output of the task is a non-existent directory, which Gradle determines on the first run. Gradle already sees you have the expected state (non-existent directory) on the second run, so there’s no reason to run the task again. If ...some other logic... is actually creating other output, you’re not properly declaring that.
You should minimally declare ${buildDir}/javadoc-public as an output directory or ${buildDir}/javadoc-public/modulename-javadoc.jar as an output file.
However, deleting the directory in the task as well as combining the generation and jar creation is atypical. Generally, these would be two separate tasks that depend on each other and you would not delete the folder as part of the regular build.