Applying plugin in "apply from:" file


(Yoshiyuki Kinjo) #1

I’d like to apply gradle-js-plugin from a script other than build.gradle.

build.gradle

apply from: 'js.gradle'

js.gradle

buildscript {
  repositories { mavenCentral() }
  dependencies {
    classpath 'com.eriwen:gradle-js-plugin:1.5.0'
  }
}
  apply plugin: 'js'
  javascript.source {
  dev {
    js {
      srcDir src
    }
  }
}

This fails with “Plugin with id ‘js’ not found.” error. If I move buildscript block and ‘apply plugin: ‘js’’ to build.gradle, things go well. However, my actual build.gradle is several hundred length, so I’m inclined to separate file in above way.

How can I get around with this?


(Peter Niederwieser) #2

It’s a known issue. You can apply the plugin by its fully qualified class name:

apply plugin: com.eriwen.gradle.js.JsPlugin

(Yoshiyuki Kinjo) #3

This works for me, thank you. Could you show me a reference to related problem description (just for curiosity)?


(Suneetha Yanala) #4

I have the same issue. Hope it will solve the problem. But how can I call my task from this gradle into my build.gradle