Task ‘run’ not found in root project

问题现象:

Task 'run' not found in root project 'springframework'.

问题原因:

     没有在gradle.build文件中添加如下配置,

mainClassName  是 application 的一个属性,需要一起使用。
apply plugin: 'application'
mainClassName = 'hello.HelloWorld'

类似问题:

https://discuss.gradle.org/t/task-run-not-found-in-root-project/12130

I figured it out: my gradle.build did not have the line

apply plugin: 'application'

原文地址:https://www.cnblogs.com/zheting/p/7679362.html