Q:

Configuration with name 'testRuntimeClasspath' not found

I am designing a plugin to return all the dependencies of the project
I tried to get dependencies from project.getConfigurations() but it is always returning the error "Configuration with name 'testRuntimeClasspath' not found". Is there any way we can apply the plugin at the Execution Phase of the build.
public void apply(Project project) {
   project.getConfigurations()                                  
   .getByName("testRuntimeClasspath")
   .getAllDependencies();

}

A:

The existing configurations in a Gradle build depend on the plugin(s) applied and any configuration created by the build author.
So your plugin should either support well known plugins and derive configurations name from them or have a way for the users of your plugin to register which configurations are to be queried that way or a combination of both.
Not sure what your plugin's goal is, but y9ou should be mindful when listing dependencies as it will force resolution of configurations that may otherwise not need to be resolved.

