groovy.lang.MissingPropertyException: No such property: srcDirs for class: org.gradle.model.dsl.internal.GroovyModelDsl


(Cyrill Sizov) #1

Hi! With gradle 1.9 and the following config:

apply plugin: 'java'
  sourceSets {
    main {
        java.srcDirs = ['src/api']
    }
    model {
        java.srcDirs = ['src/model']
    }
}

i get this:

15:28:42.425 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
15:28:42.427 [ERROR] [org.gradle.BuildExceptionReporter] A problem occurred evaluating root project '1.9'.
15:28:42.429 [ERROR] [org.gradle.BuildExceptionReporter] > No such property: srcDirs for class: org.gradle.model.dsl.internal.GroovyModelDsl
15:28:42.434 [ERROR] [org.gradle.BuildExceptionReporter]
 15:28:42.436 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is:
15:28:42.440 [ERROR] [org.gradle.BuildExceptionReporter] org.gradle.api.GradleScriptException: A problem occurred evaluating root project '1.9'.
15:28:42.442 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:54)
15:28:42.444 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:132)
15:28:42.445 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:38)
15:28:42.447 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:25)
15:28:42.449 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:34)
15:28:42.451 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:55)
15:28:42.453 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:507)
15:28:42.455 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:82)
15:28:42.457 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:31)
15:28:42.459 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:142)
15:28:42.460 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)
15:28:42.462 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)
15:28:42.464 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:64)
15:28:42.466 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
15:28:42.468 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
15:28:42.470 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:35)
15:28:42.472 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
15:28:42.474 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)
15:28:42.476 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.api.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
15:28:42.477 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:201)
15:28:42.479 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:174)
15:28:42.481 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:170)
15:28:42.483 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139)
15:28:42.485 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
15:28:42.487 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
15:28:42.490 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.launcher.Main.doAction(Main.java:46)
15:28:42.492 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
15:28:42.495 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.launcher.Main.main(Main.java:37)
15:28:42.498 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
15:28:42.501 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
15:28:42.503 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
15:28:42.506 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:33)
15:28:42.508 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:130)
15:28:42.510 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
15:28:42.512 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: groovy.lang.MissingPropertyException: No such property: srcDirs for class: org.gradle.model.dsl.internal.GroovyModelDsl
15:28:42.515 [ERROR] [org.gradle.BuildExceptionReporter]
      at build_44fu4r8ri4dbiinp3708f455eh$_run_closure1_closure3.doCall(/home/phx/1/1.9/build.gradle:9)
15:28:42.517 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:58)
15:28:42.526 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.api.internal.project.AbstractProject.model(AbstractProject.java:1007)
15:28:42.527 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.api.internal.project.DefaultProject_Decorated.model(Unknown Source)
15:28:42.533 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.api.internal.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:246)
15:28:42.537 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:134)
15:28:42.540 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:147)
15:28:42.546 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.groovy.scripts.BasicScript.methodMissing(BasicScript.java:79)
15:28:42.548 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.api.internal.BeanDynamicObject$GroovyObjectAdapter.invokeMethod(BeanDynamicObject.java:289)
15:28:42.550 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:134)
15:28:42.552 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.api.internal.ConfigureDelegate.invokeMethod(ConfigureDelegate.java:64)
15:28:42.554 [ERROR] [org.gradle.BuildExceptionReporter]
      at build_44fu4r8ri4dbiinp3708f455eh$_run_closure1.doCall(/home/phx/1/1.9/build.gradle:8)
15:28:42.556 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:58)
15:28:42.558 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:130)
15:28:42.561 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:91)
15:28:42.563 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.api.internal.AbstractNamedDomainObjectContainer.configure(AbstractNamedDomainObjectContainer.java:67)
15:28:42.565 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.api.internal.AbstractNamedDomainObjectContainer.configure(AbstractNamedDomainObjectContainer.java:23)
15:28:42.567 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.api.NamedDomainObjectContainer$configure.call(Unknown Source)
15:28:42.569 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.api.plugins.JavaPluginConvention.sourceSets(JavaPluginConvention.groovy:109)
15:28:42.571 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.api.plugins.JavaPluginConvention.invokeMethod(JavaPluginConvention.groovy)
15:28:42.573 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.api.internal.BeanDynamicObject$GroovyObjectAdapter.invokeMethod(BeanDynamicObject.java:289)
15:28:42.575 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:134)
15:28:42.577 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.api.internal.plugins.DefaultConvention$ExtensionsDynamicObject.invokeMethod(DefaultConvention.java:218)
15:28:42.579 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:147)
15:28:42.581 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.groovy.scripts.BasicScript.methodMissing(BasicScript.java:79)
15:28:42.583 [ERROR] [org.gradle.BuildExceptionReporter]
      at build_44fu4r8ri4dbiinp3708f455eh.run(/home/phx/1/1.9/build.gradle:4)
15:28:42.585 [ERROR] [org.gradle.BuildExceptionReporter]
      at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:52)
15:28:42.587 [ERROR] [org.gradle.BuildExceptionReporter]
      ... 33 more
15:28:42.589 [ERROR] [org.gradle.BuildExceptionReporter]

It worked with gradle 1.8


(Luke Daley) #2

This is an unfortunate naming collision.

While we work it out, you can get around it by changing:

model {

To:

delegate.model {