Make sure APIs are nicely consumable from other languages

When I write compiled Plugins, I like to use a language with better auto completion than Groovy (especially inside Closures). Xtend, Scala and even Java 8 come to mind.

Many of Gradle’s APIs are already very good in this regard. For instance most of them also accept an Action instead of a Groovy Closure. Also, most dynamic constructs like Extensions and DomainObjectCollections can be accessed in a more verbose, but typesafe way.

But there are some APIs which cannot be used at all without Reflection. One of them is the MavenDeployer API. It uses Reflection to configure the POM and Repository. Trying to use the Maven APIs directly will result in NoClassDefFoundErrors, because the Maven jars are apparently not on the Plugin’s runtime classpath.

I know that using a reflective builder is very convenient implementation-wise and safes you some time. But please consider users of other languages who want to integrate with these APIs.

It’s a clear goal for all APIs to be fully Java compatible, and for the most part this has already been accomplished. The Maven APIs are a special case; at some point, the ‘maven’ plugin will go away in favor of the ‘maven-publish’ plugin, which doesn’t leak the Maven APIs in the first place.

That’s good to know =)

And yes, most of the APIs are very nicely usable, so thank you guys for going the extra mile =)