拉取gradle项目, 依赖拉不下来, 报错如下:
Could not find method compile() for arguments XXXXXX on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
找了很多篇文章都没有解决,后来在stack overflow上面找到了答案:
Note that the
compile
,runtime
,testCompile
, andtestRuntime
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
implementation
,runtimeOnly
,testImplementation
, andtestRuntimeOnly
, respectively.
我的gradle是7之后了, 所以就是将compile改成implementation即可.
如下:
项目compile成功!!!
参考文章:
java - Could not find method compile() for arguments Gradle - Stack Overflow