Plugin not found when I using a gradle from other gradle file

Hi,

I have minJs.gradle to minify JS which is using plugin. When I run the build individually its executing fine. But when I use this gradle file in my main build.gradle like

apply from: ‘minJs.gradle’

I am getting the error as follows ---------------------------------------------

  • What went wrong: A problem occurred evaluating script. > Plugin with id ‘js’ not found.

My minJs.gradle as follows

buildscript {

repositories {

flatDir(dirs: ‘c:/sun/local-repo’) }

dependencies {

classpath ‘com.eriwen:gradle-js-plugin:1.5.1’

classpath fileTree(dir: ‘c:/sun/local-repo’, include: ‘compiler.jar’)

} } // Invoke the plugin apply plugin: ‘js’

task addJs {

FileTree sourceTree = fileTree(dir: ‘WebContent/js’) sourceTree.eachWithIndex { jsFile, idx ->

tasks.create(name: “dominify${idx}”, type: com.eriwen.gradle.js.tasks.MinifyJsTask) {

source = jsFile

// dest = “${buildDir}/${jsFile.name}”

dest = jsFile

println jsFile

}

closure {

warningLevel = ‘QUIET’

compilationLevel = ‘SIMPLE_OPTIMIZATIONS’

//

externs = files(“ext-4.2.0.663/ext.js”)

} } } //addJs

task individualMinify(dependsOn: tasks.matching { Task task ->

println task.name

task.name.startsWith(“dominify”)} )

This is a known issue. You will need to apply the JS plugin by type in your script plugin (minJs.gradle).

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

sigh. having the same problem, but gradle reports: “could not find property ‘com’ …”

Are you sure you are adding the plugin dependency to the build script’s classpath?