没有这样的属性:COMPILE_ONLY_CONFIGURATION_NAME类:org.gradle.api.plugins.JavaPlugin

时间:2017-08-08 10:35:42

标签: grails gradle gradlew

我有Groovy和Grails项目,我使用过资产管道。

Grails:3.0.17#Gradle:2.12

在我的build.gradle文件中,我已应用资产管道,如下所示:

apply plugin: "asset-pipeline"

在构建项目时,我遇到以下错误:

  

org.gradle.api.GradleScriptException:评估项目':ciab-base'时出现问题。       在org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory $ ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:54)       at org.gradle.configuration.DefaultScriptPluginFactory $ ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:154)       在org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:39)       在org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:26)       在org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:34)       在org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:59)       在org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:492)       在org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:86)       在org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:47)       在org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:35)       在org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:129)       在org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106)       在org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86)       at org.gradle.launcher.exec.InProcessBuildActionExecuter $ DefaultBuildController.run(InProcessBuildActionExecuter.java:80)       在org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)       在org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)       在org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:36)       at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)       在org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:51)       在org.gradle.internal.Actions $ RunnableActionAdapter.execute(Actions.java:169)       在org.gradle.launcher.cli.CommandLineActionFactory $ ParseAndBuildAction.execute(CommandLineActionFactory.java:237)       在org.gradle.launcher.cli.CommandLineActionFactory $ ParseAndBuildAction.execute(CommandLineActionFactory.java:210)       在org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)       在org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)       在org.gradle.launcher.cli.CommandLineActionFactory $ WithLogging.execute(CommandLineActionFactory.java:206)       在org.gradle.launcher.cli.CommandLineActionFactory $ WithLogging.execute(CommandLineActionFactory.java:169)       在org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)       在org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)       在org.gradle.launcher.Main.doAction(Main.java:33)       在org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)       在org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)       在org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)       在org.gradle.launcher.GradleMain.main(GradleMain.java:23)       在org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30)       在org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:127)       在org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:56)   引起:org.gradle.api.internal.plugins.PluginApplicationException:无法应用插件[id' asset-pipeline']       在org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:147)       在org.gradle.api.internal.plugins.DefaultPluginManager.apply(DefaultPluginManager.java:102)       at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.applyType(DefaultObjectConfigurationAction.java:113)       at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.access $ 200(DefaultObjectConfigurationAction.java:36)       在org.gradle.api.internal.plugins.DefaultObjectConfigurationAction $ 3.run(DefaultObjectConfigurationAction.java:80)       在org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.execute(DefaultObjectConfigurationAction.java:136)       在org.gradle.api.internal.project.AbstractPluginAware.apply(AbstractPluginAware.java:46)       在org.gradle.api.plugins.PluginAware $ apply.call(未知来源)       在org.gradle.api.internal.project.ProjectScript.apply(ProjectScript.groovy:34)       在org.gradle.api.Script $ apply $ 0.callCurrent(Unknown Source)       at build_eutmpfkdca3gfie59pyomub8f.run(/home/urvin/Urvin/Repo/ciab-plugin/ciab-base/build.gradle:32)       在org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory $ ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:52)       ......还有35个   引起:groovy.lang.MissingPropertyException:类没有这样的属性:COMPILE_ONLY_CONFIGURATION_NAME:org.gradle.api.plugins.JavaPlugin       在asset.pipeline.gradle.AssetPipelinePlugin $ _createGradleConfiguration_closure2.doCall(AssetPipelinePlugin.groovy:191)       在org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:67)       在org.gradle.internal.Actions $ FilteredAction.execute(Actions.java:201)       在org.gradle.api.internal.DefaultDomainObjectCollection.all(DefaultDomainObjectCollection.java:110)       在org.gradle.api.internal.DefaultDomainObjectCollection.all(DefaultDomainObjectCollection.java:115)       at org.gradle.api.internal.DefaultDomainObjectCollection.withType(DefaultDomainObjectCollection.java:126)       at org.gradle.api.DomainObjectCollection $ withType $ 0.call(Unknown Source)       在asset.pipeline.gradle.AssetPipelinePlugin.createGradleConfiguration(AssetPipelinePlugin.groovy:189)       at asset.pipeline.gradle.AssetPipelinePlugin.apply(AssetPipelinePlugin.groovy:52)       at asset.pipeline.gradle.AssetPipelinePlugin.apply(AssetPipelinePlugin.groovy)       在org.gradle.api.internal.plugins.ImperativeOnlyPluginApplicator.applyImperative(ImperativeOnlyPluginApplicator.java:35)       在org.gradle.api.internal.plugins.RulesCapablePluginApplicator.applyImperative(RulesCapablePluginApplicator.java:42)       在org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:133)       ......还有46个

1 个答案:

答案 0 :(得分:3)

我遇到了同样的错误。

这是因为你正在使用的grails版本,期望gradle 2.11和资产管道插件(需要2.12)之间不匹配。

要解决这个问题,你可以用grails开始grails(替换你的gradle路径):

$ GRAILS_GRADLE_HOME=~/.sdkman/candidates/gradle/2.12/ grails