在我的项目中执行grails run-app
时遇到问题。错误如下:
| Running application...
Loading development gradle script for Project....
Loading development gradle script for HMPlugin....
Loading development gradle script for PCPlugin....
Loading development gradle script for PEPlugin....
Loading development gradle script for PDPlugin....
Loading development gradle script for PPlugin....
Loading development gradle script for PCUIPlugin....
Loading development gradle script for PTPPlugin....
Loading development gradle script for DTPlugin....
Loading development gradle script for DESPlugin....
Loading development gradle script for PPPlugin....
Loading development gradle script for APlugin....
Loading development gradle script for ECUIPlugin....
Error: Could not find or load main class
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':DESPlugin:bootRun'.
> Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_211.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
查看上面的日志,它试图在插件DESPlugin中而不是在主项目中找到主类。在主项目的build.gradle文件中,我输入的内容为:
mainClassName = 'pf.Application'
Grails版本如下:
| Grails Version: 3.1.6
| Groovy Version: 2.4.6
| JVM Version: 1.8.0_211
Gradle版本如下:
------------------------------------------------------------
Gradle 2.13
------------------------------------------------------------
Build time: 2016-04-25 04:10:10 UTC
Build number: none
Revision: 3b427b1481e46232107303c90be7b05079b05b1c
Groovy: 2.4.4
Ant: Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM: 1.8.0_211 (Oracle Corporation 25.211-b12)
OS: Mac OS X 10.14.5 x86_64
我也在其他站点也研究了SO的不同解决方案,但找不到解决方案。
引用的网站: http://blog.professional-webworkx.de/grails-gradle-build-failed-how-to-solve/
注意:该项目在Linux计算机上运行正常,仅在Mac上存在问题。