Prannoy Singh
Prannoy Singh

Reputation: 43

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();

}

Upvotes: 2

Views: 2815

Answers (1)

Louis Jacomet
Louis Jacomet

Reputation: 14500

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.

Upvotes: 1

Related Questions