Configure subprojects at root build.gradle

I’m trying to have a common configuration steps for certain projects at root level build.gradle.

My script would look like something below:

sub_project_set.each { eachProject

  configure([eachProject]){
      configurations {
            a
      }
     
      dependencies{
            a link.to.maven.repo     
      }

      configurations.a.each{....}
      ....
      }
   }
}

When project configuring, Gradle would warn me that "Resolution of the configuration: eachProject was attempted from a context different than the project context" at line configurations.a.each (at least it’s on the top of the call stack), and this feature is deprecated and will be removed at Gradle 8.0 .

However, if I changed configure([eachProject]) to project(eachProject), Gradle seems having no problem with that. Function-wise, both works for me the same way.

Obviously something behind scene is not the same, I’m wondering what that is?

Thanks in advance for any help.