How to declare external libraries in JVM component plugins

Hi, everyone.

I’m trying JVM component plugins. I have a question, how can I declare external libraries (like slf4j) in JVM component plugins.

For example,

plugins {
  id 'jvm-component'
  id 'java-lang'

model { 
  components {
    basic(JvmLibrarySpec) {
      targetPlatform 'java6'
    functions(JvmLibrarySpec) {
      targetPlatform 'java6'
      sources {
        java {
          dependencies {
            library 'basic'
            // I'd like to add this external library.
            compile 'org.jetbrains:annotations:13.0'

But in this case model (components.functions.getSources() > named(functions)) don’t have method compile. So, I’m wondering how to declare external libraries.

The gradle nightly refers to this.
So I guess you can try the latest nightly, or wait for 2.10

Support for this is very new so the documentation hasn’t quite caught up. You can take a look at the integration tests for a usage example if you’d like.

Also as @Francois_Guillot alluded to, this exists only in master so you’ll need to use a recent nightly build.

@Francois_Guillot, @mark_vieira
Thanks! I can’t wait its release.