写点什么

Gradle 使用问题梳理

用户头像
maijun
关注
发布于: 2020 年 12 月 12 日

1. Gradle 工程无法执行 main 方法

错误提示:

15:36:00: Executing task 'AstParser.main()'...

FAILURE: Build failed with an exception.
* Where:Initialization script 'C:\Users\maijun\AppData\Local\Temp\AstParser_main__.gradle' line: 18
* What went wrong:A problem occurred configuring root project 'javaparser-test'.> Could not create task ':AstParser.main()'. > Unnecessarily replacing a task that does not exist is not supported. Use create() or register() directly instead. You attempted to replace a task named 'AstParser.main()', but there is no existing task with that name.
* Try:Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.Use '--warning-mode all' to show the individual deprecation warnings.See https://docs.gradle.org/6.7/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 224msUnnecessarily replacing a task that does not exist is not supported. Use create() or register() directly instead. You attempted to replace a task named 'AstParser.main()', but there is no existing task with that name.15:36:00: Task execution finished 'AstParser.main()'.
复制代码

解决方法

在 .idea 目录下,gradle.xml 的 <GradleProjectSettings> 标签下,添加下面框中的内容(<option name="delegatedBuild" value="false" />),如下:


用户头像

maijun

关注

还未添加个人签名 2019.09.20 加入

还未添加个人简介

评论

发布
暂无评论
Gradle使用问题梳理