【错误记录】IntelliJ IDEA 编译 Groovy 报错 ( GroovyRuntimeException: This script or class could not be run. )
2023-09-14 09:07:28 时间
一、错误记录
运行
class Student1 {
}
Groovy 代码 , 会报错 ;
报错信息 :
groovy.lang.GroovyRuntimeException: This script or class could not be run.
It should either:
- have a main method,
- be a JUnit test or extend GroovyTestCase,
- implement the Runnable interface,
- or be compatible with a registered script runner. Known runners:
* <none>
二、问题分析
只有符合如下要求的 Groovy 代码可以运行 :
-
有 main 函数 ;
-
测试用例 , 作为JUnit测试或扩展GroovyTestCase ;
-
线程相关 , 实现Runnable接口 ;
-
与注册的脚本运行程序兼容 ;
其它情况的 Groovy 代码 , 均不可运行 ;
相关文章
- 【错误】IntelliJ IDEA使用Gradle编译报错
- spss modeler出现使用错误提
- WCF 在应用程序级别之外使用注册为 allowDefinition='MachineToApplication' 的节是错误的。
- 对 SAP UI5 应用使用 uiveri5 执行测试的 ERR_CONNECTION_REFUSED 错误
- paip.python错误解决23
- 使用 cf push 部署应用到 SAP BTP 时遇到错误消息 No domains exist for route
- 使用测试帐号访问SAP云平台Cloud Foundry Cockpit的错误消息
- 使用自开发的代理服务器解决 SAP UI5 FileUploader 上传文件时遇到的跨域访问错误试读版
- 初识ASP.NET---若干常见错误
- [Azure - VNet] 解决办法:Windows 10/11中 Azure P2S 无法建立网络连接问题。 (错误 809)
- 解决办法:错误异常The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
- Mysql----在持续集成(CI)的流程测试环境对应的Mysql数据库报无法连接错误问题的解决办法
- 【Python】使用LogisticRegression出现错误: invalid type promotion
- 关于Recon-ng的“[!] Unable to synchronize module index. (ConnectionError),等一系列ConnectionError错误”