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

在command line执行命令

gradle clean bootJar --no-daemon

报错

Could not find method compile() for arguments [io.micrometer:micrometer-registry-prometheus:1.5.11] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

常出现在安装了OpenJDK 16 with gradle

解决办法:

compile and testCompile configurations are removed in Gradle 7+. You can use implementation and testImplementation instead.

使用implementation 替换 compile 即可

参考:
https://intellij-support.jetbrains.com/hc/en-us/community/posts/4403048541330-Could-not-find-method-testCompile-for-arguments-group-junit-name-junit-version-4-12-on-object-of-type-org-gradle-api-internal-artifacts-dsl-dependencies-DefaultDependencyHandler-

上一篇:org.hibernate.LazyInitializationException: could not initialize proxy - no Session


下一篇:SharePoint - Update SPSolution失败的解决方案