The configuration :runtimeClasspath was resolved without accessing the project in a safe manner

hi ,

i am using gradle 6.5.1 for my project. it is groovy based project and it is not a multi project.
i have only src and test directory under my project directory. i am trying to get ant-unit jar path
from dependency list and i am getting below warning.

The configuration :runtimeClasspath was resolved without accessing the project in a safe manner. This may happen when a configuration is resolved from a different project. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0. See https://docs.gradle.org/6.5/userguide/viewing_debugging_dependencies.html#sub:resolving-unsafe-configuration-resolution-errors for more details.

code snippet :
def antJunitJar = configurations.runtimeClasspath.find { it.name.startsWith(“ant-junit”) }

how to fix this warning ?