Install
The brand new MyBatis-Plus
3.0 version is based on JDK 8 and provides lambda
-style calls, so the installation and integration requirements for MP 3.0 are as follows:
- JDK 8+
- Maven or Gradle
Release
Spring Boot 2
<dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> <version>3.5.12</version></dependency>
implementation 'com.baomidou:mybatis-plus-boot-starter:3.5.12'
Spring Boot 3
<dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-spring-boot3-starter</artifactId> <version>3.5.12</version></dependency>
implementation 'com.baomidou:mybatis-plus-spring-boot3-starter:3.5.12'
Spring
<dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus</artifactId> <version>3.5.12</version></dependency>
implementation 'com.baomidou:mybatis-plus:3.5.12'
Solon
<dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-solon-plugin</artifactId> <version>3.5.12</version></dependency>
implementation 'com.baomidou:mybatis-plus-solon-plugin:3.5.12'
Snapshot
The SNAPSHOT version requires adding a repository, and the version number is the snapshot version Click to view the latest snapshot version number.
Maven:
<repository> <id>snapshots</id> <url>https://central.sonatype.com/repository/maven-snapshots/</url></repository>
When the snapshot cannot be downloaded through a proxy repository, please add !snapshots
to mirrorOf.
<mirror> <id>aliyunmaven</id> <mirrorOf>*,!snapshots</mirrorOf> <name>阿里云公共仓库</name> <url>https://maven.aliyun.com/repository/public</url></mirror>
Gradle:
repositories { maven { url 'https://central.sonatype.com/repository/maven-snapshots/' }}
Maven bom
Use
maven bom
to manage dependencies and reduce version conflicts. Becausejsqlparser 5.0+
versions no longer supportjdk8
, thejsqlparser
dependency is decoupled to address this issue. The correct way is to introduce themybatis-plus-bom
module, and then introduce the..starter
and..jsqlparser..
dependencies.mybatis-plus-jsqlparser: This dependency will be updated with the latest supported version of jsqlparser.
mybatis-plus-jsqlparser-xx: This is for specific supported versions of jsqlparser, meaning versions that are not compatible with updates.
- Maven
<dependencyManagement> <dependencies> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-bom</artifactId> <version>3.5.9+ version</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies></dependencyManagement>
<!-- Optional module for Spring Boot 3 --><dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-spring-boot3-starter</artifactId></dependency>
<!-- Optional module for JDK 11+ --><dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-jsqlparser</artifactId></dependency>
<!-- Optional module for Spring Boot 2 --><dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId></dependency>
<!-- Optional module for JDK 8+ --><dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-jsqlparser-4.9</artifactId></dependency>
- Gradle
// Dependency ManagementdependencyManagement { imports { mavenBom "com.baomidou:mybatis-plus-bom:3.5.9+ version" }}
// Optional module for Spring Boot 3implementation("com.baomidou:mybatis-plus-spring-boot3-starter")
// Optional module for JDK 11+implementation("com.baomidou:mybatis-plus-jsqlparser")
// Optional module for Spring Boot 2implementation("com.baomidou:mybatis-plus-boot-starter")
// Optional module for JDK 8+implementation("com.baomidou:mybatis-plus-jsqlparser-4.9")