we use gradleApi() as compile dependency in one of our gradle plugins. We also use classes of common-lang ourselves in our plugin, that comes with gradleApi. In any build, were we use our plugin, these classes of common-lang cannot be found. Is this the expected behaviour? I would expect that any dependencies, that ship with gradleApi() are available in my gradlebuild in any gradle build.
Yes, I would say this is the expected behavior. If you don’t specify a dependency that you need, you won’t have it. The Gradle build script for the application that uses your plugin is not going to know about the dependencies of your plugin that you’re not specifying. If your application needs commons-lang, you’re going to have to add it as a dependency.
Yes that’s the behavior… And it always bothered me a little.
‘gradleApi()’ is a convenient way of adding a looooot of dependencies when crafting a plug-in.
These dependencies are part of the gradle distribution. Gradle itself uses them in its core. So it would make sense to make them available as well for any Gradle build.
With the current behavior, the gradleApi() compile dependency is not available at runtime, whereas regular dependencies are.
This breaks the fact that runtime extends compile dependencies.