The compile keyword for dependency is introduced into gradle for old projects. After upgrading gradle version 7. X, this keyword is enabled.
After checking the documentation, if the jar package of the project is to be exposed, use API. If the referenced jar package is only used by the project, use implementation.
Core, the jar package reference of the public module is changed to API, but an error is reported
A problem occurred evaluating project ':inkyi-common'.
> Could not find method api() for arguments [org.springframework.boot:spring-boot-starter-web:2.6.1] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
That means: without API, Baidu has said to upgrade gradle 3. X for a long time. Isn’t that bullshit
After reading the official website, the first sentence gives the answer: API belongs to the method in Java library
Put the in build.gradle
plugins {
id 'java'
}
Change to
plugins {
id 'java-library'
}
Just do it.
Similar Posts:
- How to Solve IDEA Error: “Library source does not match the bytecode for class”
- Android studio import project, error e rror:Unsupported method : BaseConfig.getApplicationIdSuffix().
- [Solved] Gradle Error: Could not resolve all dependencies for configuration ‘:detachedConfiguration7
- [Solved] Gitlab-runner Error: ERROR: Could not create cache adapter error=cache factory not found: factory for cache adapter “” was not registered
- Gradle Packages Springboot Error: no main manifest attribute, in ./build/libs/scaffold-1.0-SNAPSHOT.jar
- Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin [id ‘com.android.internal.application’]
- Gradle‘s dependency cache may be corrupt [How to Solve]
- [Solved] Android Warning: Gradle DSL method not found: ‘android()’
- AS Import Project Error: Plugin with id ‘com.android.application’ not found.
- [Solved] Apt-get -f install Error: No apport report written because MaxReports is reached already Errors were…