【MinIO】SpringBoot引入MinIO依赖遇到的一些问题:okhttp、kotlib-stdlib
参考官方文档SDK:https://docs.min.io/docs/java-client-quickstart-guide.html
MinIO Java SDK is Simple Storage Service (aka S3) client to perform bucket and object operations to any Amazon S3 compatible object storage service.
MinIO依赖jar包下载地址:Central Repository: io/minio/minio
JDK最低要求:Java 1.8 或更高版本。
【异常1】maven仓库MinIO 8.3.4下载很慢
解决办法:maven设置依赖下载地址
1 <repositories>
2 <repository>
3 <id>public</id>
4 <name>aliyun nexus</name>
5 <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
6 <releases>
7 <enabled>true</enabled>
8 </releases>
9 </repository>
10 </repositories>
11
12 <pluginRepositories>
13 <pluginRepository>
14 <id>public</id>
15 <name>aliyun nexus</name>
16 <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
17 <releases>
18 <enabled>true</enabled>
19 </releases>
20 <snapshots>
21 <enabled>false</enabled>
22 </snapshots>
23 </pluginRepository>
24 </pluginRepositories>
【异常2】Caused by: java.lang.RuntimeException: Unsupported OkHttp library found. Must use okhttp >= 4.8
解决办法:maven引入minio排除okhttp依赖并添加高版本的okhttp依赖,如okhttp 4.9.0
1 <!-- 对象存储 MinIO -->
2 <dependency>
3 <groupId>io.minio</groupId>
4 <artifactId>minio</artifactId>
5 <version>8.3.4</version>
6 <exclusions>
7 <exclusion>
8 <groupId>com.squareup.okhttp3</groupId>
9 <artifactId>okhttp</artifactId>
10 </exclusion>
11 </exclusions>
12 </dependency>
13
14 <dependency>
15 <groupId>com.squareup.okhttp3</groupId>
16 <artifactId>okhttp</artifactId>
17 <version>4.9.0</version>
18 </dependency>
【异常3】NoSuchMethodError kotlin.collections.ArraysKt.copyInto([B[BIII)[B
解决办法:指定kotlib-stdlib的版本
<!-- https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-stdlib -->
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>1.3.70</version>
</dependency>
本文来自博客园,作者:小刘爱学习呀,转载请注明原文链接:https://www.cnblogs.com/liuhao-blog/p/18208239