GoogleCloudPlatform / GoogleCloudPlatform/cloud-opensource-java

Libraries BOM for Guava's -jre flavor (Java 8+)

Đang mở
#1,884 6 bình luận 0 reaction 0 người được giao Xem trên GitHub
blocked p3
Ngôn ngữ chính
Java
Star
163
Fork
80
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Shall we create the Libraries BOM with Guava's -jre flavor?

As of now, the Libraries BOM uses Guava's -android flavor. This flavor of Guava does not have methods for Java 8+, such as `CacheBuilder.expireAfterWrite(java.time.Duration)`. ([Duration](https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html) class was introduced in Java 8.) If a project uses the Libraries BOM and depends on a library that touches the Java 8+ methods (for example `com.google.cloud.bigdataoss:gcsio`), the JVM throws `NoSuchMethodError`:

```
java.lang.NoSuchMethodError: com.google.common.cache.CacheBuilder.expireAfterWrite(Ljava/time/Duration;)Lcom/google/common/cache/CacheBuilder;
at com.google.cloud.hadoop.gcsio.GoogleCloudStorageImpl.(GoogleCloudStorageImpl.java:149)
```

Therefore, Java 8 users in such situations need to override the version of Guava. The step is documented in https://github.com/GoogleCloudPlatform/cloud-opensource-java/wiki/The-Google-Cloud-Platform-Libraries-BOM#guava-versions--jre-or--android . As noted there we cannot override Gradle's `enforcedPlatform` keyword, which controls transitive dependency versions. (`platform` works but this does not control transitive dependencies) Maven users can override transitive dependencies by adding guava entry in the `dependencyManagement` section.

Given that Java 8 users are majority right now (Java 7 users are few percent in GCP), shall we target for Java 8 users as the main audience?

This request is from @kileys (Dataflow team). The options listed below are prepared by suztomo.

# Option 1: change main target audience to Java 8 users

- The Libraries BOM includes Guava's -jre flavor that supports Java 8 operations
- Java 7 users can override the guava version as in the wiki page.

# Option 2: two flavors of the Libraries BOM

- We publish 2 flavors of the Libraries BOM for both Java 8+ and Java 7.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.