com.wttch.plugin.libs.dependencies.Mybatis.kt Maven / Gradle / Ivy
The newest version!
package com.wttch.plugin.libs.dependencies
import com.wttch.plugin.libs.dependencies.base.BaseDependency
import org.gradle.kotlin.dsl.exclude
object Mybatis {
const val springBootGroup = "org.mybatis.spring.boot"
const val defaultSpringBootVersion = "2.1.2"
const val group = "org.mybatis"
const val defaultVersion = "3.5.4"
val mybatis = MybatisDependency("mybatis")
val spring = MybatisDependency("mybatis-spring").version("2.0.4")
var springBoot = MybatisStarterDependency("mybatis-spring-boot-starter")
class MybatisDependency(name: String) : BaseDependency(group, name, defaultVersion) {
override fun defaultVersion() = defaultVersion
}
class MybatisStarterDependency(name: String) :
BaseDependency(springBootGroup, name, defaultSpringBootVersion) {
override fun defaultVersion() = defaultSpringBootVersion
/**
* 移除 Mybatis Starter 中的 spring-tx/spring-jdbc 依赖, 这个依赖版本和 spring-boot-jdbc 中的不一致.
*/
fun excludeSpringJdbc() {
exclude(Spring.Boot.group, Spring.Boot.starterJdbc.name)
exclude(Spring.group, Spring.tx.name)
exclude(Spring.group, Spring.jdbc.name)
}
}
}