从Grails 2.x迁移到3.x后,我的build.gradle文件失败并出现以下错误。
无法应用插件[id'grails'] 无法在[Java source'main:j上找到参数[main]的方法create() ava',JVM资源'主要:资源',Java源'测试:java',JVM资源'te ST:资源]
apply plugin:'grails'在子项目任务中定义。
的build.gradle
buildscript {
repositories {
mavenLocal()
jcenter()
maven { url "https://repo.grails.org/grails/core" }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.2.5.RELEASE")
classpath 'org.grails:grails-gradle-plugin:2.1.1'
}
}
version = projectVersion
/*
* Subprojects configuration and its tasks
*/
subprojects {
repositories {
mavenLocal()
jcenter()
maven { url "https://repo.grails.org/grails/core" }
}
/*
* Applying Plugins at subproject level
*/
apply plugin: "spring-boot"
apply plugin: 'grails'
apply plugin: "war"
apply plugin: 'eclipse'
apply plugin: 'idea'
堆栈跟踪
org.gradle.api.GradleScriptException: A problem occurred evaluating root project
'sample'.
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptR
unnerImpl.run(DefaultScriptRunnerFactory.java:93)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl$
1.run(DefaultScriptPluginFactory.java:148)
at org.gradle.configuration.ProjectScriptTarget.addConfiguration(Project
ScriptTarget.java:72)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.
apply(DefaultScriptPluginFactory.java:153)
at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildSc
riptProcessor.java:38)
at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildSc
riptProcessor.java:25)
at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.eva
luate(ConfigureActionsProjectEvaluator.java:34)
at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(L
ifecycleProjectEvaluator.java:55)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProj
ect.java:491)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProj
ect.java:89)
at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(Task
PathProjectEvaluator.java:42)
at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuil
dConfigurer.java:35)
at org.gradle.initialization.DefaultGradleLauncher$2.run(DefaultGradleLa
uncher.java:126)
at org.gradle.internal.Factories$1.create(Factories.java:22)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(Defaul
tBuildOperationExecutor.java:90)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(Defaul
tBuildOperationExecutor.java:52)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(Default
GradleLauncher.java:123)
at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGra
dleLauncher.java:33)
at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradl
eLauncher.java:100)
at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradl
eLauncher.java:94)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(Defaul
tBuildOperationExecutor.java:90)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(Defaul
tBuildOperationExecutor.java:62)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradle
Launcher.java:94)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLaun
cher.java:83)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildCon
troller.run(InProcessBuildActionExecuter.java:94)
at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(Exe
cuteBuildActionRunner.java:28)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildA
ctionRunner.java:35)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProce
ssBuildActionExecuter.java:43)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProce
ssBuildActionExecuter.java:28)
at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(Contin
uousBuildActionExecuter.java:77)
at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(Contin
uousBuildActionExecuter.java:47)
at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.exe
cute(DaemonUsageSuggestingBuildActionExecuter.java:51)
at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.exe
cute(DaemonUsageSuggestingBuildActionExecuter.java:28)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:43)
at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.jav
a:170)
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(JavaRunti
meValidationAction.java:35)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRunti
meValidationAction.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(ExceptionRep
ortingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionRep
ortingAction.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(ProcessBoots
trap.java:54)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.j
ava:35)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to
apply plugin [id 'grails']
at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultP
luginManager.java:160)
at org.gradle.api.internal.plugins.DefaultPluginManager.apply(DefaultPlu
ginManager.java:112)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.appl
yType(DefaultObjectConfigurationAction.java:112)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.acce
ss$200(DefaultObjectConfigurationAction.java:35)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction$3.ru
n(DefaultObjectConfigurationAction.java:79)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.exec
ute(DefaultObjectConfigurationAction.java:135)
at org.gradle.api.internal.project.AbstractPluginAware.apply(AbstractPlu
ginAware.java:46)
at build_76213vzvbmfxlviw96kj1e2w5$_run_closure2.doCall(C:\build.gradle:73)
at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedActi
on.java:67)
at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:130)
at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:91)
at org.gradle.api.internal.project.AbstractProject.configure(AbstractPro
ject.java:827)
at org.gradle.api.internal.project.AbstractProject.configure(AbstractPro
ject.java:832)
at org.gradle.api.internal.project.AbstractProject.subprojects(AbstractP
roject.java:815)
at org.gradle.api.internal.BeanDynamicObject$MetaClassAdapter.invokeMeth
od(BeanDynamicObject.java:232)
at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObj
ect.java:127)
at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(Composite
DynamicObject.java:150)
at org.gradle.groovy.scripts.BasicScript.methodMissing(BasicScript.java:
79)
at build_76213vzvbmfxlviw96kj1e2w5.run(C:\build.gradle:
58)
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptR
unnerImpl.run(DefaultScriptRunnerFactory.java:91)
... 47 more
Caused by: org.gradle.api.internal.MissingMethodException: Could not find method
create() for arguments [main] on [Java source 'main:java', JVM resources 'main:
resources', Java source 'test:java', JVM resources 'test:resources'].
at org.gradle.api.internal.AbstractDynamicObject.methodMissingException(
AbstractDynamicObject.java:68)
at org.gradle.api.internal.AbstractDynamicObject.invokeMethod(AbstractDy
namicObject.java:56)
at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(Composite
DynamicObject.java:175)
at org.gradle.language.base.internal.DefaultProjectSourceSet_Decorated.i
nvokeMethod(Unknown Source)
at org.grails.gradle.plugin.GrailsSourceSetConfigurator$1.execute(Grails
SourceSetConfigurator.groovy:36)
at org.grails.gradle.plugin.GrailsSourceSetConfigurator$1.execute(Grails
SourceSetConfigurator.groovy)
at org.gradle.listener.ActionBroadcast.execute(ActionBroadcast.java:39)
at org.gradle.api.internal.DefaultDomainObjectCollection.doAdd(DefaultDo
mainObjectCollection.java:165)
at org.gradle.api.internal.DefaultDomainObjectCollection.add(DefaultDoma
inObjectCollection.java:159)
at org.gradle.api.internal.DefaultNamedDomainObjectCollection.add(Defaul
tNamedDomainObjectCollection.java:81)
at org.gradle.api.internal.AbstractNamedDomainObjectContainer.create(Abs
tractNamedDomainObjectContainer.java:58)
at org.gradle.api.internal.AbstractNamedDomainObjectContainer.create(Abs
tractNamedDomainObjectContainer.java:52)
at org.gradle.api.internal.NamedDomainObjectContainerConfigureDelegate._
configure(NamedDomainObjectContainerConfigureDelegate.java:39)
at org.gradle.api.internal.ConfigureDelegate.invokeMethod(ConfigureDeleg
ate.java:73)
at org.grails.gradle.plugin.GrailsSourceSetConfigurator$_createMainSourc
eSet_closure1.doCall(GrailsSourceSetConfigurator.groovy:59)
at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedActi
on.java:67)
at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:130)
at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:91)
at org.gradle.api.internal.AbstractNamedDomainObjectContainer.configure(
AbstractNamedDomainObjectContainer.java:68)
at org.gradle.api.internal.AbstractNamedDomainObjectContainer.configure(
AbstractNamedDomainObjectContainer.java:24)
at org.gradle.api.NamedDomainObjectContainer$configure$0.call(Unknown So
urce)
at org.grails.gradle.plugin.internal.DefaultGrailsProject.sourceSets(Def
aultGrailsProject.groovy:68)
at org.grails.gradle.plugin.GrailsProject$sourceSets.call(Unknown Source
)
at org.grails.gradle.plugin.GrailsSourceSetConfigurator.createMainSource
Set(GrailsSourceSetConfigurator.groovy:58)
at org.grails.gradle.plugin.GrailsSourceSetConfigurator$createMainSource
Set$0.callCurrent(Unknown Source)
at org.grails.gradle.plugin.GrailsSourceSetConfigurator.configure(Grails
SourceSetConfigurator.groovy:50)
at org.grails.gradle.plugin.GrailsSourceSetConfigurator$configure.call(U
nknown Source)
at org.grails.gradle.plugin.GrailsPlugin.configureSourceSets(GrailsPlugi
n.groovy:154)
at org.grails.gradle.plugin.GrailsPlugin$configureSourceSets$0.callCurre
nt(Unknown Source)
at org.grails.gradle.plugin.GrailsPlugin.apply(GrailsPlugin.groovy:105)
at org.grails.gradle.plugin.GrailsPlugin.apply(GrailsPlugin.groovy)
at org.gradle.api.internal.plugins.ImperativeOnlyPluginApplicator.applyI
mperative(ImperativeOnlyPluginApplicator.java:35)
at org.gradle.api.internal.plugins.RuleBasedPluginApplicator.applyImpera
tive(RuleBasedPluginApplicator.java:43)
at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultP
luginManager.java:144)
... 66 more
答案 0 :(得分:0)
尝试将您的Maven回购更改(或添加)到:
maven { url "https://repo.grails.org/grails/repo" }
(repo
代替core
)。
答案 1 :(得分:0)
申请插件:' grails'不适用于最新的grails gradle插件版本