文章目录
- 一、Client 连通
官方 API 文档:Documentation
官方中文文档:MinIO中文文档
一、Client 连通
Java 代码:
MinioClient minioClient =MinioClient.builder().endpoint("http://192.168.110.110:9000").credentials("xiaoqiang", "heheda123").build();System.out.println(minioClient);// 检查桶是否存在boolean found = minioClient.bucketExists(BucketExistsArgs.builder().bucket("test").build());if (!found) {// 创建桶minioClient.makeBucket(MakeBucketArgs.builder().bucket("test").build());}//列出所有桶名List<Bucket> buckets = minioClient.listBuckets();for (Bucket i : buckets){System.out.println(i.name());}
Maven 引入:
<!--此依赖为minio的服务依赖--><dependency><groupId>io.minio</groupId><artifactId>minio</artifactId><version>8.5.7</version></dependency>
报错:
<dependency><groupId>io.minio</groupId><artifactId>minio</artifactId><version>8.5.2</version></dependency><!--或者--><dependency><groupId>io.minio</groupId><artifactId>minio</artifactId><version>8.4.5</version></dependency><!--或者--><dependency><groupId>io.minio</groupId><artifactId>minio</artifactId><version>8.3.7</version></dependency>
报错:
<dependency><groupId>io.minio</groupId><artifactId>minio</artifactId><version>8.2.1</version></dependency><!--或者--><dependency><groupId>io.minio</groupId><artifactId>minio</artifactId><version>8.1.0</version></dependency><!--或者--><dependency><groupId>io.minio</groupId><artifactId>minio</artifactId><version>8.0.3</version></dependency>
报错:Exception in thread "main" java.lang.NoSuchMethodError: kotlin.collections.ArraysKt.copyInto([B[BIII)[B
尝试解决1:
结论:不好使。
尝试解决2:新建一个纯 Maven 项目。好使