Compilation error encountered for gradle-js-plugin on gradle-2.8

plugins

(Prashant Mahajan) #1

Have updated my gradle from 1.12 to 2.8 and now when I try to compile my git repo I am encountering error w.r.t jsplugin (1.12.1) which is getting used for javascript code coverage.
Source code of plugin : https://github.com/eriwen/gradle-js-plugin
Snippet Of error:

:plugins:JSPlugin:compileTestGroovy
startup failed:
/my git path/plugins/JSPlugin/src/test/groovy/com/eriwen/gradle/js/util/FunctionalSpec.groovy: 5: unable to resolve class org.gradle.GradleLauncher
@ line 5, column 1.
import org.gradle.GradleLauncher
^
1 error
:plugins:JSPlugin:compileTestGroovy FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ‘:plugins:JSPlugin:compileTestGroovy’.
Compilation failed; see the compiler error output for details.

  • Try:
    Run with --info or --debug option to get more log output.

What I could figure it out was problem is coming while running test from file “FunctionalSpec.groovy” present in src/test/groovy/com/eriwen/gradle/js/util/

Below is the problematic code which I suspect is giving trouble

GradleLauncher launcher(String… args) {
StartParameter startParameter = GradleLauncher.createStartParameter(args)
startParameter.setProjectDir(dir.dir)

if (settingsFile.exists()) {
    startParameter.settingsFile = settingsFile
} else {
    startParameter.useEmptySettings()
}
GradleLauncher launcher = GradleLauncher.newInstance(startParameter)
executedTasks.clear()
launcher.addListener(new TaskExecutionListener() {
    void beforeExecute(Task task) {}
    void afterExecute(Task task, TaskState taskState) {
        getExecutedTasks() << new ExecutedTask(task, new IncrementalTaskState(taskState))
    }
})
launcher

}

Any advice on how can I make it run on gradle-2.8


(Sterling Greene) #2

The 1.12.1 version number represents the version of Gradle it’s compatible with.

The master branch has been updated to work with 2.x. There’s a 2.14.1 release: https://plugins.gradle.org/plugin/com.eriwen.gradle.js

Is there anything in particular keeping you with Gradle 2.8? 4.0.2 is the latest release.


(Prashant Mahajan) #3

Hi Sterling,
Other git repo’s are having dependencies on us thus have to see the overall compatibility.As of now, we are on gradle 1.12 and plan to move to gradle 2.8 in future.This is the last leg of problem that is remaining.Rest all things have been sorted out.

Please help me in this.
Thanks,
Prashant


(Prashant Mahajan) #4

Also to add here, the problem is encountered while running below tests :

com.eriwen.gradle.js.JsPluginFunctionalTest > basic processing chain FAILED
groovy.lang.MissingMethodException: No signature of method: com.eriwen.gradle.js.JsPluginFunctionalTest.launcher() is applicable for argument types: (java.lang.String) values: [copyProcessed]
at com.eriwen.gradle.js.JsPluginFunctionalTest.basic processing chain(JsPluginFunctionalTest.groovy:55)

com.eriwen.gradle.js.JsPluginFunctionalTest > tasks operation FAILED
groovy.lang.MissingMethodException: No signature of method: com.eriwen.gradle.js.JsPluginFunctionalTest.launcher() is applicable for argument types: ([Ljava.lang.String;) values: [[minifyJs]]
at com.eriwen.gradle.js.util.FunctionalSpec.run(FunctionalSpec.groovy:42)
at com.eriwen.gradle.js.JsPluginFunctionalTest.tasks operation(JsPluginFunctionalTest.groovy:96)

com.eriwen.gradle.js.JsHintTaskTest > does not generate checkstyle report when disabled FAILED
groovy.lang.MissingPropertyException: No such property: checkstyle for class: com.eriwen.gradle.js.tasks.JsHintTask_Decorated
at org.gradle.api.internal.plugins.ExtraPropertiesDynamicObjectAdapter.setProperty(ExtraPropertiesDynamicObjectAdapter.java:46)
at org.gradle.api.internal.CompositeDynamicObject.setProperty(CompositeDynamicObject.java:122)
at com.eriwen.gradle.js.JsHintTaskTest.does not generate checkstyle report when disabled(JsHintTaskTest.groovy:101)

com.eriwen.gradle.js.JsHintTaskTest > fails without predef option to jshint FAILED
groovy.lang.MissingPropertyException: No such property: checkstyle for class: com.eriwen.gradle.js.tasks.JsHintTask_Decorated
at org.gradle.api.internal.plugins.ExtraPropertiesDynamicObjectAdapter.setProperty(ExtraPropertiesDynamicObjectAdapter.java:46)
at org.gradle.api.internal.CompositeDynamicObject.setProperty(CompositeDynamicObject.java:122)
at com.eriwen.gradle.js.JsHintTaskTest.fails without predef option to jshint(JsHintTaskTest.groovy:129)

com.eriwen.gradle.js.JsHintTaskTest > passes with predef option to jshint FAILED
groovy.lang.MissingPropertyException: No such property: checkstyle for class: com.eriwen.gradle.js.tasks.JsHintTask_Decorated
at org.gradle.api.internal.plugins.ExtraPropertiesDynamicObjectAdapter.setProperty(ExtraPropertiesDynamicObjectAdapter.java:46)
at org.gradle.api.internal.CompositeDynamicObject.setProperty(CompositeDynamicObject.java:122)
at com.eriwen.gradle.js.JsHintTaskTest.passes with predef option to jshint(JsHintTaskTest.groovy:144)


(Sterling Greene) #5

The version of the plugin you’re trying to build doesn’t work with 2.x. The master branch of the repo you linked to has updates to make it work with 2.x


(Prashant Mahajan) #6

Thank you Sterling for helping this out.Will try building with the latest master branch.