You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by ie...@apache.org on 2019/03/20 08:45:27 UTC

[beam] branch master updated: [BEAM-6770] Correct zstd-jni dependency scope to tests only

This is an automated email from the ASF dual-hosted git repository.

iemejia pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new fe976f1  [BEAM-6770] Correct zstd-jni dependency scope to tests only
     new 75b9737  Merge pull request #8096: [BEAM-6770] Correct zstd-jni dependency scope to tests only
fe976f1 is described below

commit fe976f18ac3cbbd40efb9216fd3c95e778a34f71
Author: Jeff Klukas <je...@klukas.net>
AuthorDate: Tue Mar 19 21:48:52 2019 -0400

    [BEAM-6770] Correct zstd-jni dependency scope to tests only
    
    As discussed in
    [the Jira ticket](https://issues.apache.org/jira/browse/BEAM-6770),
    we are moving this dependency to be test-only by default and documenting
    that it's the user's responsibility to explicitly declare a dependency on
    `zstd-jni` before attempting to read or write .zst files.
    
    `zstd-jni` is effectively now an optional dependency, even though it won't
    be explicity listed as such in the produced pom. The cost:benefit ratio
    of codifying an optional dependency in the build is considered low
    at this point.
---
 sdks/java/core/build.gradle                                          | 2 +-
 sdks/java/core/src/main/java/org/apache/beam/sdk/io/Compression.java | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/sdks/java/core/build.gradle b/sdks/java/core/build.gradle
index 7b74675..a4a1264 100644
--- a/sdks/java/core/build.gradle
+++ b/sdks/java/core/build.gradle
@@ -76,7 +76,6 @@ dependencies {
   shadow library.java.slf4j_api
   shadow library.java.avro
   shadow library.java.snappy_java
-  shadow library.java.zstd_jni
   shadow library.java.joda_time
   shadow "org.tukaani:xz:1.8"
   provided library.java.junit
@@ -91,4 +90,5 @@ dependencies {
   shadowTest "com.esotericsoftware.kryo:kryo:2.21"
   shadowTest library.java.quickcheck_core
   shadowTest library.java.avro_tests
+  shadowTest library.java.zstd_jni
 }
diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/io/Compression.java b/sdks/java/core/src/main/java/org/apache/beam/sdk/io/Compression.java
index 48ea8a2..04ced7d 100644
--- a/sdks/java/core/src/main/java/org/apache/beam/sdk/io/Compression.java
+++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/io/Compression.java
@@ -134,6 +134,11 @@ public enum Compression {
    *
    * <p>The {@code .zst} extension is specified in <a href=https://tools.ietf.org/html/rfc8478>RFC
    * 8478</a>.
+   *
+   * <p>The Beam Java SDK does not pull in the Zstd library by default, so it is the user's
+   * responsibility to declare an explicit dependency on {@code zstd-jni}. Attempts to read or write
+   * .zst files without {@code zstd-jni} loaded will result in {@code NoClassDefFoundError} at
+   * runtime.
    */
   ZSTD(".zst", ".zst", ".zstd") {
     @Override