I try to add a dependency to a plugin developed as part of a multiproject build in the buildSrc folder of my project. To reproduce the problem, I took the “multiProjectBuildSrc” sample and modified it as follows:
A) Apply the groovy plugin to buildSrc root project to avoid the exception “Could not find method runtime() for arguments [project ‘:plugina’]” when executing ‘gradle dependencies’ in folder ‘buildSrc’
// buildSrc/build.gradle
apply plugin: "groovy"
B) Added a build.gradle project to Plugin A where I define the dependency.
// buildSrc/plugina/build.gradle
repositories {
mavenCentral()
}
dependencies {
compile 'commons-io:commons-io:2.4''
}
Executing ‘gradle dependencies’ in the folder ‘buildSrc/plugina’ works as expected.
Executing ‘gradle dependencies’ in the ‘buildSrc’ folder shows the following dependency failure:
------------------------------------------------------------
Root project
------------------------------------------------------------
...
default - Configuration for default artifacts.
+--- project :plugina
|
\--- commons-io:commons-io:2.4 FAILED
\--- project :pluginb
...
Executing ‘gradle dependencies’ in the root folder of the project shows the following dependency failure:
Could not resolve all dependencies for configuration ':runtime'.
> Could not find commons-io:commons-io:2.4.
Required by:
:buildSrc:unspecified > buildSrc:plugina:unspecified
What is the missing piece to avoid the “Could not resolve all dependencies for configuration ‘:runtime’” failure?