gradle-cucumber-plugin icon indicating copy to clipboard operation
gradle-cucumber-plugin copied to clipboard

v0.8 - unsupported Gradle DSL method found: 'dependsOn()'

Open pbellchambers opened this issue 10 years ago • 2 comments

I'm using Java 8, and Gradle 2.1, and my build script has a dependsOn() on the cucumber task:

cucumber.dependsOn startLocal

With v0.8 of the cucumber plugin my build always fails with the following error, if I go back to the previous version (0.7.2) the build works fine:

FAILURE: Build failed with an exception.

* Where:
Build file 'build.gradle' line: 220

* What went wrong:
A problem occurred evaluating project ':mainapp'.
> Could not find method dependsOn() for arguments [task ':mainapp:startLocal'] on com.excella.gradle
.cucumber.CucumberConvention_Decorated@4462efe1.

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

* Exception is:
org.gradle.api.GradleScriptException: A problem occurred evaluating project ':mainapp'.
        at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:54)
        at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:190)
        at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:39)
        at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:26)
        at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:34)
        at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:55)
        at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:521)
        at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:82)
        at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:31)
        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:129)
        at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106)
        at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:80)
        at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
        at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:36)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
        at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:51)
        at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)
        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
        at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
        at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
        at org.gradle.launcher.Main.doAction(Main.java:33)
        at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
        at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
Caused by: org.gradle.api.internal.MissingMethodException: Could not find method dependsOn() for arguments [task ':mainapp:startLocal'] on com.excella.gradle.cucumber.CucumberConvention_Decorated@4462efe1.
        at org.gradle.api.internal.AbstractDynamicObject.methodMissingException(AbstractDynamicObject.java:68)
        at org.gradle.api.internal.AbstractDynamicObject.invokeMethod(AbstractDynamicObject.java:56)
        at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:172)
        at com.excella.gradle.cucumber.CucumberConvention_Decorated.invokeMethod(Unknown Source)
        at build_61p7jjuf629r521tm9k3qlufgq.run(build.gradle:220)
        at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:52)
        ... 31 more


BUILD FAILED

Total time: 2.983 secs

pbellchambers avatar Oct 01 '14 09:10 pbellchambers

I see. I didn't realize that DSLs are the tasks themselves, really. I'll fix it as soon as I can.

viphe avatar Oct 01 '14 15:10 viphe

Now that I looked at it closer, it seems I broke a feature that is not quite obvious.

The cucumber {} DSL is supposed to configure the plugin more than just the default instance of CucumberTask named cucumber.

I followed what the Gradle team advises and replaced (some of) the never-officially-published convention mechanism by the extension one. However, the convention mechanism auto-magically mixes the convention object (the DSLobject) with the task of the same name as far as I can tell.

To properly implement a dependsOn plugin-level config, I would have to add it to the extension/convention bean.

If you want to upgrade to v0.8, I would advice to explicitly deal with the task by writing the following for now;

project.tasks.cucumber.dependsOn startLocal

Not sure what the best approach is, really.

viphe avatar Oct 04 '14 19:10 viphe