grails-core: Gradle 5 - Grails 3 simple multi-project app/plugin won't compile
Task List
- Steps to reproduce provided
- Stacktrace (if present) provided
- Example that reproduces the problem uploaded to Github - [[ non needed]]
- Full description of the issue provided (see below)
Steps to Reproduce
- create a new plugin: $ grails create-plugin core --profile=plugin --features=hibernate5,events
- create a new app to use that plugin] $ grails create-app myapp
- create settings.gradle at the same dir as core/myapp: include “myapp”,“core”
- add the dependency to myapp build.gradle:
grails {
plugins {
compile project(':core')
}
}
- try to compile either the plugin, or the application (both give identical results) . THis fails with error below, as do commands to create new domain objects etc.
Expected Behaviour
App or plugin compiles
Actual Behaviour
| Resolving Dependencies. Please wait...
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/me/dev/grails_projects/tst/core/build.gradle' line: 17
* What went wrong:
A problem occurred evaluating project ':core'.
> Failed to apply plugin [id 'org.grails.grails-plugin']
> Could not find method runtimeOnly() for arguments [io.methvin:directory-watcher] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Environment Information
- Operating System: OSX10.13.6
- Grails Version: 3.3.9
- JDK Version: 1.8.0_131
- **Container Version (If Applicable): NA
Example Application
There is no source code to upload, as commands to create new domain objects etc. also fail with the same error.
Here is the build.gradle from the core plugin. Note, line 17 is:
apply plugin:"org.grails.grails-plugin"
buildscript {
repositories {
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
}
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsVersion"
classpath "org.grails.plugins:hibernate5:${gormVersion-".RELEASE"}"
}
}
version "0.1"
group "core"
apply plugin:"eclipse"
apply plugin:"idea"
apply plugin:"org.grails.grails-plugin"
apply plugin:"org.grails.grails-plugin-publish"
repositories {
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
}
dependencies {
compile "org.springframework.boot:spring-boot-starter-logging"
compile "org.springframework.boot:spring-boot-autoconfigure"
compile "org.grails:grails-core"
compile "org.grails.plugins:events"
compile "org.grails.plugins:hibernate5"
compile "org.hibernate:hibernate-core:5.1.16.Final"
console "org.grails:grails-console"
profile "org.grails.profiles:plugin"
provided "org.grails:grails-plugin-services"
provided "org.grails:grails-plugin-domain-class"
runtime "org.glassfish.web:el-impl:2.1.2-b03"
runtime "com.h2database:h2"
runtime "org.apache.tomcat:tomcat-jdbc"
testCompile "org.grails:grails-gorm-testing-support"
testCompile "org.grails:grails-plugin-testing"
}
bootRun {
jvmArgs('-Dspring.output.ansi.enabled=always')
addResources = true
String springProfilesActive = 'spring.profiles.active'
systemProperty springProfilesActive, System.getProperty(springProfilesActive)
}
// enable if you wish to package this plugin as a standalone application
bootRepackage.enabled = false
grailsPublish {
// TODO: Provide values here
user = 'user'
key = 'key'
githubSlug = 'foo/bar'
license {
name = 'Apache-2.0'
}
title = "My Plugin"
desc = "Full plugin description"
developers = [johndoe:"John Doe"]
}
Here is the full stack trace:
| Error Error initializing classpath: Could not find method runtimeOnly() for arguments [io.methvin:directory-watcher] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException: Could not find method runtimeOnly() for arguments [io.methvin:directory-watcher] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
at org.gradle.internal.metaobject.AbstractDynamicObject.methodMissingException(AbstractDynamicObject.java:182)
at org.gradle.internal.metaobject.ConfigureDelegate.invokeMethod(ConfigureDelegate.java:89)
at org.grails.gradle.plugin.core.GrailsGradlePlugin$_enableFileWatch_closure17.doCall(GrailsGradlePlugin.groovy:490)
at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:70)
at org.gradle.util.ConfigureUtil.configureTarget(ConfigureUtil.java:160)
at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:106)
at org.gradle.api.internal.project.DefaultProject.dependencies(DefaultProject.java:940)
at org.gradle.api.Project$dependencies$1.call(Unknown Source)
at org.grails.gradle.plugin.core.GrailsGradlePlugin.enableFileWatch(GrailsGradlePlugin.groovy:488)
at org.grails.gradle.plugin.core.GrailsGradlePlugin.configureFileWatch(GrailsGradlePlugin.groovy:305)
at org.grails.gradle.plugin.core.GrailsGradlePlugin.apply(GrailsGradlePlugin.groovy:118)
at org.grails.gradle.plugin.core.GrailsPluginGradlePlugin.apply(GrailsPluginGradlePlugin.groovy:57)
at org.grails.gradle.plugin.core.GrailsPluginGradlePlugin.apply(GrailsPluginGradlePlugin.groovy)
at org.gradle.api.internal.plugins.ImperativeOnlyPluginApplicator.applyImperative(ImperativeOnlyPluginApplicator.java:35)
at org.gradle.api.internal.plugins.RuleBasedPluginApplicator.applyImperative(RuleBasedPluginApplicator.java:43)
at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:139)
at org.gradle.api.internal.plugins.DefaultPluginManager.apply(DefaultPluginManager.java:112)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.applyType(DefaultObjectConfigurationAction.java:113)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.access$200(DefaultObjectConfigurationAction.java:36)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction$3.run(DefaultObjectConfigurationAction.java:80)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.execute(DefaultObjectConfigurationAction.java:136)
at org.gradle.api.internal.project.AbstractPluginAware.apply(AbstractPluginAware.java:44)
at org.gradle.api.internal.project.ProjectScript.apply(ProjectScript.java:34)
at org.gradle.api.Script$apply$0.callCurrent(Unknown Source)
at build_cld27zdkokaepye6lpqgvr80t.run(/Users/simonh/dev/grails_projects/tst3/common/build.gradle:17)
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:90)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl$2.run(DefaultScriptPluginFactory.java:177)
at org.gradle.configuration.ProjectScriptTarget.addConfiguration(ProjectScriptTarget.java:77)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:182)
at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:38)
at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:25)
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.DefaultProject.evaluate(DefaultProject.java:573)
at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:125)
at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:47)
at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:38)
at org.gradle.initialization.DefaultGradleLauncher$2.run(DefaultGradleLauncher.java:124)
at org.gradle.internal.Factories$1.create(Factories.java:22)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:53)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:121)
at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:98)
at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:92)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:63)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:92)
at org.gradle.initialization.DefaultGradleLauncher.getBuildAnalysis(DefaultGradleLauncher.java:88)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.configure(InProcessBuildActionExecuter.java:102)
at org.gradle.tooling.internal.provider.runner.ClientProvidedBuildActionRunner.run(ClientProvidedBuildActionRunner.java:45)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.tooling.internal.provider.runner.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:58)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:82)
at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:49)
at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:59)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:49)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
at org.gradle.util.Swapper.swap(Swapper.java:38)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.HintGCAfterBuild.execute(HintGCAfterBuild.java:44)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:240)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
| Error Error initializing classpath: Could not find method runtimeOnly() for arguments [io.methvin:directory-watcher] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 38 (19 by maintainers)
Commits related to this issue
- https://github.com/grails/grails-core/issues/11221 — committed to osscontributor/issue11221 by deleted user 5 years ago
Right. Much of the long post doesn’t contribute directly to clarifying anything about the initial bug report. Some of that would be better suited for a blog or maybe a personal diary.
Thanks for the feedback!
I’m new to grails, trying to rebuild a multi project from an old grails version. I ran into the same error building with inline plugins. Finally I found this tutorial:
https://guides.grails.org/grails-multi-project-build/guide/index.html
Now my plugin builds with the app. The trick is that all the gradle files must be moved up from the app folder to the main folder of the multiproject.
The issue for me was having Gradle 6.x installed form SKDMAN and a Grails 3.3.10 app. When I switched the Gradle version to 3.5 in SDKMAN, the Grails app worked as expected. It’s an issue that working on a multi-version environment, we need to remember on which version of Gradle each app should build and run…
As far as I can tell, the issue reported here is related to trying to use Gradle 5 with Grails 3.3.x, which isn’t supported.
Agreed. I was addressing the claim “grails 3.3.9 grails is fundamentally broken and cant support mulit-module apps” which is not true.