style: 优化 Gradle 文档。

This commit is contained in:
Suomm 2023-08-17 15:05:50 +08:00
parent 6a4fa7ad8a
commit 33cb4a39fe

View File

@ -1,14 +1,13 @@
# Gradle 依赖 # Gradle 依赖
> 以下的 xml gradle 依赖示例中,可能并非最新的 MyBatis-Flex 版本,请自行查看最新版本,并修改版本号。 > 以下的 gradle 依赖示例中,可能并非最新的 MyBatis-Flex 版本,请自行查看最新版本,并修改版本号。
>
> 建议配置 annotationProcessor那么可以省略mybatis-flex-processor的依赖
>
> 建议配置 annotationProcessor那么可以省略 `mybatis-flex-processor` 的依赖。
1、只用到了 MyBatis没用到 Spring 的场景: 1、只用到了 MyBatis没用到 Spring 的场景:
**【Kotlin】** **【Kotlin】**
```kotlin ```kotlin
dependencies { dependencies {
implementation("com.mybatis-flex:mybatis-flex-core:1.5.6") implementation("com.mybatis-flex:mybatis-flex-core:1.5.6")
@ -16,6 +15,7 @@ dependencies {
``` ```
**【Groovy】** **【Groovy】**
```groovy ```groovy
dependencies { dependencies {
implementation 'com.mybatis-flex:mybatis-flex-core:1.5.6' implementation 'com.mybatis-flex:mybatis-flex-core:1.5.6'
@ -25,6 +25,7 @@ dependencies {
2、用到了 Spring 的场景 2、用到了 Spring 的场景
**【Kotlin】** **【Kotlin】**
```kotlin ```kotlin
dependencies { dependencies {
implementation("com.mybatis-flex:mybatis-flex-spring:1.5.6") implementation("com.mybatis-flex:mybatis-flex-spring:1.5.6")
@ -32,14 +33,17 @@ dependencies {
``` ```
**【Groovy】** **【Groovy】**
```groovy ```groovy
dependencies { dependencies {
implementation 'com.mybatis-flex:mybatis-flex-spring:1.5.6' implementation 'com.mybatis-flex:mybatis-flex-spring:1.5.6'
} }
``` ```
3、用到了 Spring Boot 的场景 3、用到了 Spring Boot 的场景
**【Kotlin】** **【Kotlin】**
```kotlin ```kotlin
dependencies { dependencies {
implementation("com.mybatis-flex:mybatis-flex-spring-boot-starter:1.5.6") implementation("com.mybatis-flex:mybatis-flex-spring-boot-starter:1.5.6")
@ -47,21 +51,23 @@ dependencies {
``` ```
**【Groovy】** **【Groovy】**
```groovy ```groovy
dependencies { dependencies {
implementation 'com.mybatis-flex:mybatis-flex-spring-boot-starter:1.5.6' implementation 'com.mybatis-flex:mybatis-flex-spring-boot-starter:1.5.6'
} }
``` ```
4. 配置 annotationProcessor 4配置 annotationProcessor
`mybatis-flex-processor`提供APT服务。 `mybatis-flex-processor` 提供APT服务。
参考:[APT 设置-和 Lombok、Mapstruct 整合](../others/apt.md) 参考:[APT 设置-和 Lombok、Mapstruct 整合](../others/apt.md)
> 在Kotlin中使用时请参考[在Kotlin中使用注解处理器](../others/kapt.md) > 在Kotlin中使用时请参考[在Kotlin中使用注解处理器](../others/kapt.md)
**【Kotlin】** **【Kotlin】**
```kotlin ```kotlin
dependencies { dependencies {
annotationProcessor("com.mybatis-flex:mybatis-flex-processor:1.5.6") annotationProcessor("com.mybatis-flex:mybatis-flex-processor:1.5.6")
@ -69,6 +75,7 @@ dependencies {
``` ```
**【Groovy】** **【Groovy】**
```groovy ```groovy
dependencies { dependencies {
annotationProcessor 'com.mybatis-flex:mybatis-flex-processor:1.5.6' annotationProcessor 'com.mybatis-flex:mybatis-flex-processor:1.5.6'