Transitive dependencies in buildscript block

Hi there,

Here’s my situation:

  • I have a multi-project build - One of these projects builds a custom gradle plugin that should be used by other teams in the company later - This custom gradle plugin has some transitive dependencies (e.g. apache velocity to generate code)

Now the tricky part: one of the plugin-project’s sibling projects should use the plugin at build time. In that other project’s build.gradle, I have the following:

buildscript {
    repositories { mavenRepo ... }
      dependencies {
        classpath (
          [group: 'commons-lang', name: 'commons-lang', version: '2.6'],
          [group: 'velocity', name: 'velocity', version: '1.4'],
          [group: 'log4j', name: 'log4j', version: '1.2.16'],
          [group: 'commons-io', name: 'commons-io', version: '1.2'],

The commented out dependencies are also present in the custom-gradle-plugin’s dependencies, but somehow, they’re not in the resulting classpath when the plugin calls:


What I want is to define these third party dependencies in the custom-plugin project and not have to worry about them when using the plugin in other projects (well, transitive dependencies ;))

What am I missing?!

Thanks in advance, Mike Meessen

You can’t have a sibling project in the build script section. It would mean that the sibling project has to be built before the build script is even evaluated, but that’s not how multi-project builds work. The solution is to move the sibling project into buildSrc, or to have a separate build for it.

Thanks for putting me into the right direction, Peter. :slight_smile:

It’s one “core framework” and I’d like to try avoiding a separate build so I moved the custom-gradle-plugin project to the buildSrc subfolder of my build. Gradle finds and builds it before it starts building my main project. So far so good.

However, my main project complains about “Cause: Plugin with id ‘custom-gradle-plugin’ not found.”

I should mention that I wrote the plugin in Java and am packaging a Jar with the plugin metadata in META-INF/gradle-plugins. So it looks like the main build doesn’t load the plugins included in the jar resulting from the buildSrc project or something…

Any idea? What am I missing?

Thanks in advance! - Mike