[MinIO] Some problems encountered by SpringBoot introducing MinIO dependencies: okhttp, kotlib-stdlib

MinIO reference for installing docker on centos: https://blog.csdn.net/u014698745/article/details/122025423

Refer to the official documentation 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 depends on the jar package download address: Central Repository: io/minio/minio

Minimum JDK requirement: Java 1.8 or higher.

[Exception 1] The download of MinIO 8.3.4 in the maven warehouse is very slow

Solution: maven set dependent download address

<repositories>
    <repository>
        <id>public</id>
        <name>aliyun nexus</name>
        <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
        <releases>
            <enabled>true</enabled>
        </releases>
    </repository>
</repositories>

<pluginRepositories>
    <pluginRepository>
        <id>public</id>
        <name>aliyun nexus</name>
        <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </pluginRepository>
</pluginRepositories>

【异常2】Caused by: java.lang.RuntimeException: Unsupported OkHttp library found. Must use okhttp >= 4.8

Solution: maven introduces minio to exclude okhttp dependencies and add higher version okhttp dependencies, such as okhttp 4.9.0

<!-- object storage MinIO -->
<dependency>
    <groupId>io.minio</groupId>
    <artifactId>minio</artifactId>
    <version>8.3.4</version>
    <exclusions>
        <exclusion>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>okhttp</artifactId>
        </exclusion>
    </exclusions>
</dependency>

<dependency>
    <groupId>com.squareup.okhttp3</groupId>
    <artifactId>okhttp</artifactId>
    <version>4.9.0</version>
</dependency>

【异常3】NoSuchMethodError kotlin.collections.ArraysKt.copyInto([B[BIII)[B

Solution: specify the version of 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>

おすすめ

転載: blog.csdn.net/u014698745/article/details/122025869