buildscript {
repositories.addAll(project.repositories)
dependencies {
classpath 'com.eriwen:gradle-js-plugin:1.12.1’
classpath ‘com.google.compile.js:closure-compiler:0.0.1.u’
}
}
apply plugin: “com.eriwen.gradle.js”
def temporaryDirJS
task copyResources {
copy {
from 'WebContent/js’
into “$temporaryDir"
doLast {
ant.chmod(dir: “$temporaryDir”, perm:“755”,includes:”*")
}
temporaryDirJS = “$temporaryDir”
}
}
task JSMinification() {
FileTree sourceTree = fileTree(dir: “$temporaryDirJS”)
sourceTree.eachWithIndex { jsFile, idx ->
project.tasks.create(name: “dominify${idx}”, type: com.eriwen.gradle.js.tasks.MinifyJsTask) {
source = jsFile
dest = jsFile
}
closure {
warningLevel = 'QUIET’
compilationLevel = 'WHITESPACE_ONLY’
compilerOptions.setOutputCharset(“UTF-8”)
compilerOptions.setWarningLevel(com.google.javascript.jscomp.DiagnosticGroups.INTERNET_EXPLORER_CHECKS,com.google.javascript.jscomp.CheckLevel.OFF)
}
}
}
task individualMinify(dependsOn: tasks.matching { Task task ->
task.name.startsWith(“dominify”)} )
This task fails if the JAVA_HOME is pointing JDK5. Since google compiler is compiled with Java 7. With Java5 I am getting “Caused by: java.lang.UnsupportedClassVersionError: (com/google/javascript/jscomp/DiagnosticGroups) bad major version at offset=6”. Is there a way to run these tasks alone with JAVA7 jvm. I can not move the whole build to Java7 as the requirement is to Compile the class files in JDK5.0.