Continuing the discussion from Can plugins{} DSL be used to locate custom plugins packaged in a jar of many plugins?:
After being set straight on the issue above, I made some good progress, but have come across a new stumbling block : dependencies:
My typical project that uses my plugin collection has one or more subprojects each or which usually applies one of the plugins in my collection. But the problem here is that my plugin collection itself applies other upstream plugins such as gradle-ospackage and org.hidetake.ssh. In the old scheme I can put a classpath dependency in the buildscript block of the root project for my plugin container. That no longer works because you’re not allowed to put in a plugins{}
declaration a plugin that is already on the classpath. An error message tells me to use apply
. It seems the buildscript{}
block is not really compatible with the new plugins{}
system.
But neither is it okay to put a dependencies{}
block in the root project outside of a buildscript{}
block. So in order to avoid those errors I must put my dependencies{}
block in each subproject in order for the transitive dependencies of my plugin collection to be handled correctly. This is making things more complicated. not less complicated.
Is there some way to declare that every subproject in the build depends on my plugin package (and its transitive dependencies)? I tried putting the dependencies{}
block inside a subprojects{}
block and that also fails. Specifically, code following the example of Users’ Guide Example 24.6.3:
subprojects {
repositories {
...my repos
}
dependencies {
compile "my:plugincontainer:1.0.12"
}
}
fails with this error message:
A problem occurred evaluating root project ‘{myRootProj}’
Could not find method compile() for arguments [my:plugincontainer:1.0.12] on object of type org.gradle.api.internal.artifacts.dls.dependencies.DefaultDependencyHandler.
Why?