Creating a Gradle plugin with a dependency on another (external) plugin?

(Victor Szoltysek) #1

I want to create a plugin that automatically applies other (external plugins). This requires setting the buildscript dependency for the plugin before I call “apply plugin”. However it seems like I can’t add buildscript dependencies in a plugin or I get: You can’t change a configuration which is not in unresolved state!

Is there a solution to this ?

My sample (non-working) code:

import org.gradle.api.Project
import org.gradle.api.Plugin
class SamplePlugin implements Plugin<Project>{
  void apply(Project project) {
               apply plugin: 'cobertura'

(Peter Niederwieser) #2

I’ve already answered here: