What is the proper way to add a dependency to a co...
# community-support
t
What is the proper way to add a dependency to a configuration from within a plugin on gradle 7.5? For specific dependencies it's not being added and any exception is being silently swallowed
Copy code
public class Plugin implements Plugin<Project> {

    @Override
    public void apply(Project project) {
        project.getDependencies().add("implementation", "org.openjfx:javafx-base:11.0.2:linux"); // Silently swallowed
        project.getDependencies().add("implementation", "com.github.ben-manes:gradle-versions-plugin:0.11.1"); // Works fine
    }
}
Within build.gradle:
Copy code
afterEvaluate {
  for (final def dep in getConfigurations().getByName("implementation").dependencies) {
    println("dep: " + dep)
  }
}
output is:
Copy code
dep: DefaultExternalModuleDependency{group='com.github.ben-manes', name='gradle-versions-plugin', version='0.11.1', configuration='default'}