Using ant.taskdef locks jars

for example if somewhere in a multiproject build I have the following in the configuration phase:

ant.taskdef(
            name: ...
            classname: ...
            classpath: configurations.runtime.asPath
    )

then I won’t be able to run the clean task (since my configurations.runtime includes reference to some dependent project jar)