运行命令似乎不起作用,在3.3.6和3.3.8上都尝试过
$ grails -version
| Grails Version: 3.3.8
| Groovy Version: 2.4.15
| JVM Version: 1.8.0_77
创建一个应用
grails create-app g3App
cd g3App
grails create-command Example
命令文件已创建
$ find grails-app/commands
grails-app/commands
grails-app/commands/g3app
grails-app/commands/g3app/ExampleCommand.groovy
运行示例命令
grails run-command example --stacktrace
我收到以下异常
- 例外是: org.gradle.api.tasks.TaskExecutionException:任务':runCommand'的执行失败。 在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:98) 在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:68) 在org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62) 在org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58) 在org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88) 在org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:46)处 在org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51) 在org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54) 在org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43) 在org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34) 在org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker $ 1.execute(DefaultTaskGraphExecuter.java:236) 在org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker $ 1.execute(DefaultTaskGraphExecuter.java:228) 在org.gradle.internal.Transformers $ 4.transform(Transformers.java:169) 在org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106) 在org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:61) 在org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:228)处 在org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:215)处 在org.gradle.execution.taskgraph.AbstractTaskPlanExecutor $ TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:77) 在org.gradle.execution.taskgraph.AbstractTaskPlanExecutor $ TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:58) 在org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:32) 在org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:113) 在org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37) 在org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37) 在org.gradle.execution.DefaultBuildExecuter.access $ 000(DefaultBuildExecuter.java:23) 在org.gradle.execution.DefaultBuildExecuter $ 1.proceed(DefaultBuildExecuter.java:43) 在org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32) 在org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37) 在org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30) 在org.gradle.initialization.DefaultGradleLauncher $ RunTasksAction.execute(DefaultGradleLauncher.java:230) 在org.gradle.initialization.DefaultGradleLauncher $ RunTasksAction.execute(DefaultGradleLauncher.java:227) 在org.gradle.internal.Transformers $ 4.transform(Transformers.java:169) 在org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106) 在org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:56) 在org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:161) 在org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:112) 在org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:95) 在org.gradle.launcher.exec.GradleBuildController.run(GradleBuildController.java:66) 在org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:50) 在org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35) 在org.gradle.tooling.internal.provider.runner.RunAsBuildOperationBuildActionRunner $ 1.execute(RunAsBuildOperationBuildActionRunner.java:43) 在org.gradle.tooling.internal.provider.runner.RunAsBuildOperationBuildActionRunner $ 1.execute(RunAsBuildOperationBuildActionRunner.java:40) 在org.gradle.internal.Transformers $ 4.transform(Transformers.java:169) 在org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106) 在org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:56) 在org.gradle.tooling.internal.provider.runner.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:40) 在org.gradle.tooling.internal.provider.runner.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:88) 在org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35) 在org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41)
对可能发生的事情有什么想法?我在MacOS Sierra 10.12.2上运行它
答案 0 :(得分:0)
您将需要编辑grails-app/commands/g3app/ExampleCommand.groovy
,以使handle
方法不会返回false
,该方法在首次创建时会返回。