拉取gradle项目报错Could not find method compile() for arguments

拉取gradle项目, 依赖拉不下来, 报错如下:

Could not find method compile() for arguments XXXXXX on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

拉取gradle项目报错Could not find method compile() for arguments_第1张图片

 找了很多篇文章都没有解决,后来在stack overflow上面找到了答案:

Note that the compileruntimetestCompile, and testRuntime configurations introduced by the Java plugin have been deprecated since Gradle 4.10 (Aug 27, 2018), and were finally removed in Gradle 7.0 (Apr 9, 2021).

The aforementioned configurations should be replaced by implementationruntimeOnlytestImplementation, and testRuntimeOnly, respectively.

我的gradle是7之后了, 所以就是将compile改成implementation即可.

如下:

拉取gradle项目报错Could not find method compile() for arguments_第2张图片

项目compile成功!!! 

参考文章:

java - Could not find method compile() for arguments Gradle - Stack Overflow

你可能感兴趣的:(gradle)