mirror of
https://github.com/HighCapable/SweetDependency.git
synced 2025-09-05 18:25:48 +08:00
docs: update guide
This commit is contained in:
@@ -80,12 +80,6 @@ plugins {
|
|||||||
|
|
||||||
上述配置完成后,运行一次 Gradle Sync。
|
上述配置完成后,运行一次 Gradle Sync。
|
||||||
|
|
||||||
**可能遇到的问题**
|
|
||||||
|
|
||||||
如果在运行 Gradle Sync 后失败并报错 `Cannot have abstract method KotlinTarget. withSourcesJar()`,这可能是你当前项目的 Kotlin 插件版本的问题。
|
|
||||||
|
|
||||||
此问题为 Kotlin 插件从 `1.8.0+` → `1.9.0+` 升级导致的错误,解决方案为将 Kotlin 插件的版本修改为 `1.9.0+`。
|
|
||||||
|
|
||||||
**特别注意**
|
**特别注意**
|
||||||
|
|
||||||
`SweetDependency` 会替换 `pluginManagement` 和 `dependencyResolutionManagement` 中设置的存储库,如果你手动在这些方法块中配置了存储库,它们都将会无效。
|
`SweetDependency` 会替换 `pluginManagement` 和 `dependencyResolutionManagement` 中设置的存储库,如果你手动在这些方法块中配置了存储库,它们都将会无效。
|
||||||
@@ -815,14 +809,16 @@ dependencies {
|
|||||||
|
|
||||||
在 Kotlin Multiplatform 中与一般依赖部署方式一致。
|
在 Kotlin Multiplatform 中与一般依赖部署方式一致。
|
||||||
|
|
||||||
|
为了解决可能的插件冲突,无论是 Kotlin 还是 Groovy,都需要使用 `sweet.autowire`。
|
||||||
|
|
||||||
> Kotlin DSL
|
> Kotlin DSL
|
||||||
|
|
||||||
```kotlin
|
```kotlin
|
||||||
sourceSets {
|
sourceSets {
|
||||||
val androidMain by getting {
|
val androidMain by getting {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(autowire("androidx.core:core-ktx"))
|
implementation(sweet.autowire("androidx.core:core-ktx"))
|
||||||
implementation(autowire("libs/*.jar"))
|
implementation(sweet.autowire("libs/*.jar"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -81,15 +81,6 @@ Please replace `<version>` in the above code with the latest version in
|
|||||||
|
|
||||||
After the above configuration is complete, run Gradle Sync once.
|
After the above configuration is complete, run Gradle Sync once.
|
||||||
|
|
||||||
**Possible Problems**
|
|
||||||
|
|
||||||
If running Gradle Sync fails with the error `Cannot have abstract method KotlinTarget. withSourcesJar()`,
|
|
||||||
this may be a problem with the Kotlin plugin version of your current project.
|
|
||||||
|
|
||||||
This problem is an error caused by upgrading the Kotlin plugin from `1.8.0+` → `1.9.0+`.
|
|
||||||
|
|
||||||
The solution is to modify the version of the Kotlin plugin to `1.9.0+`.
|
|
||||||
|
|
||||||
**Pay Attention**
|
**Pay Attention**
|
||||||
|
|
||||||
`SweetDependency` will replace the repositories set in `pluginManagement` and `dependencyResolutionManagement`,
|
`SweetDependency` will replace the repositories set in `pluginManagement` and `dependencyResolutionManagement`,
|
||||||
@@ -872,14 +863,16 @@ dependencies {
|
|||||||
|
|
||||||
In Kotlin Multiplatform, it is consistent with the general dependency deployment method.
|
In Kotlin Multiplatform, it is consistent with the general dependency deployment method.
|
||||||
|
|
||||||
|
To resolve possible plugin conflicts, whether Kotlin or Groovy, you need to use `sweet.autowire`.
|
||||||
|
|
||||||
> Kotlin DSL
|
> Kotlin DSL
|
||||||
|
|
||||||
```kotlin
|
```kotlin
|
||||||
sourceSets {
|
sourceSets {
|
||||||
val androidMain by getting {
|
val androidMain by getting {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(autowire("androidx.core:core-ktx"))
|
implementation(sweet.autowire("androidx.core:core-ktx"))
|
||||||
implementation(autowire("libs/*.jar"))
|
implementation(sweet.autowire("libs/*.jar"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user