Skip to content

KAFKA-7741: Streams exclude javax dependency#6121

Merged
guozhangwang merged 1 commit intoapache:trunkfrom
vvcephei:KAFKA-7741-exclude-javax
Jan 10, 2019
Merged

KAFKA-7741: Streams exclude javax dependency#6121
guozhangwang merged 1 commit intoapache:trunkfrom
vvcephei:KAFKA-7741-exclude-javax

Conversation

@vvcephei
Copy link
Copy Markdown
Contributor

As documented in https://issues.apache.org/jira/browse/KAFKA-7741,
the javax dependency we receive transitively from connect is incompatible
with SBT builds.

Streams doesn't use the portion of Connect that needs the dependency,
so we can fix the builds by simply excluding it.

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

@vvcephei
Copy link
Copy Markdown
Contributor Author

@guozhangwang @mjsax @bbejeck , can you take a look at this when you get a chance?

Thanks!

@vvcephei
Copy link
Copy Markdown
Contributor Author

vvcephei commented Jan 10, 2019

I've tested the change like this:

  1. build Kafka and install it in the local Maven repo
./gradlew installAll
  1. create a simple SBT project that depends on Streams:
mkdir /tmp/asdf
cd /tmp/asdf
cat > build.sbt << EOF
name := "ScalaKafkaStreamsDemo"

version := "1.0"

scalaVersion := "2.12.1"

resolvers += Resolver.mavenLocal


libraryDependencies += "org.apache.kafka" %% "kafka-streams-scala" % "2.2.0-SNAPSHOT"

//TEST
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.5" % Test
libraryDependencies += "org.apache.kafka" % "kafka-streams-test-utils" % "2.2.0-SNAPSHOT" % Test
EOF
  1. build the project
/tmp/asdf$ sbt compile
[info] Updated file /tmp/asdf/project/build.properties: set sbt.version to 1.2.7
[info] Loading settings for project global-plugins from idea.sbt,plugins.sbt ...
[info] Loading global plugins from /home/john/.sbt/1.0/plugins
[info] Loading project definition from /tmp/asdf/project
[info] Updating ProjectRef(uri("file:/tmp/asdf/project/"), "asdf-build")...
[info] Done updating.
[info] Loading settings for project asdf from build.sbt ...
[info] Set current project to ScalaKafkaStreamsDemo (in build file:/tmp/asdf/)
[info] Executing in batch mode. For better performance use sbt's shell
[info] Updating ...
[warn] The descriptor in file:/home/john/.m2/repository/org/apache/kafka/kafka-streams-scala_2.12/2.2.0-SNAPSHOT/kafka-streams-scala_2.12-2.2.0-SNAPSHOT.pom from Maven2 Local could not be parsed.
[warn] Resolving a snapshot version. It's going to be slow unless you use `updateOptions := updateOptions.value.withLatestSnapshots(false)` options.
[info] Out of 1 candidates we found for org.apache.kafka#kafka-streams-scala_2.12;2.2.0-SNAPSHOT in Maven2 Local, we are choosing Maven2 Local.
[warn] The descriptor in file:/home/john/.m2/repository/org/apache/kafka/kafka-streams/2.2.0-SNAPSHOT/kafka-streams-2.2.0-SNAPSHOT.pom from Maven2 Local could not be parsed.
[warn] Resolving a snapshot version. It's going to be slow unless you use `updateOptions := updateOptions.value.withLatestSnapshots(false)` options.
[info] Out of 1 candidates we found for org.apache.kafka#kafka-streams;2.2.0-SNAPSHOT in Maven2 Local, we are choosing Maven2 Local.
[warn] The descriptor in file:/home/john/.m2/repository/org/apache/kafka/kafka-clients/2.2.0-SNAPSHOT/kafka-clients-2.2.0-SNAPSHOT.pom from Maven2 Local could not be parsed.
[warn] Resolving a snapshot version. It's going to be slow unless you use `updateOptions := updateOptions.value.withLatestSnapshots(false)` options.
[info] Out of 1 candidates we found for org.apache.kafka#kafka-clients;2.2.0-SNAPSHOT in Maven2 Local, we are choosing Maven2 Local.
[warn] The descriptor in file:/home/john/.m2/repository/org/apache/kafka/connect-json/2.2.0-SNAPSHOT/connect-json-2.2.0-SNAPSHOT.pom from Maven2 Local could not be parsed.
[warn] Resolving a snapshot version. It's going to be slow unless you use `updateOptions := updateOptions.value.withLatestSnapshots(false)` options.
[info] Out of 1 candidates we found for org.apache.kafka#connect-json;2.2.0-SNAPSHOT in Maven2 Local, we are choosing Maven2 Local.
[warn] The descriptor in file:/home/john/.m2/repository/org/apache/kafka/connect-api/2.2.0-SNAPSHOT/connect-api-2.2.0-SNAPSHOT.pom from Maven2 Local could not be parsed.
[warn] Resolving a snapshot version. It's going to be slow unless you use `updateOptions := updateOptions.value.withLatestSnapshots(false)` options.
[info] Out of 1 candidates we found for org.apache.kafka#connect-api;2.2.0-SNAPSHOT in Maven2 Local, we are choosing Maven2 Local.
[warn] Resolving a snapshot version. It's going to be slow unless you use `updateOptions := updateOptions.value.withLatestSnapshots(false)` options.
[info] Out of 1 candidates we found for org.apache.kafka#kafka-streams-test-utils;2.2.0-SNAPSHOT in Maven2 Local, we are choosing Maven2 Local.
[info] Done updating.
[success] Total time: 2 s, completed Jan 10, 2019, 2:22:25 PM

Whereas, replacing 2.2.0-SNAPSHOT with 2.1.0 causes the expected error:

[warn] 	Detected merged artifact: [FAILED     ] javax.ws.rs#javax.ws.rs-api;2.1.1!javax.ws.rs-api.${packaging.type}:  (0ms).
[warn] ==== local: tried
[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/javax/ws/rs/javax.ws.rs-api/2.1.1/javax.ws.rs-api-2.1.1.${packaging.type}
[warn] ==== local-preloaded-ivy: tried
[warn]   /home/john/.sbt/preloaded/javax.ws.rs/javax.ws.rs-api/2.1.1/${packaging.type}s/javax.ws.rs-api.${packaging.type}
[warn] ==== local-preloaded: tried
[warn]   file:////home/john/.sbt/preloaded/javax/ws/rs/javax.ws.rs-api/2.1.1/javax.ws.rs-api-2.1.1.${packaging.type}
[warn] ==== Maven2 Local: tried
[warn]   file:/home/john/.m2/repository/javax/ws/rs/javax.ws.rs-api/2.1.1/javax.ws.rs-api-2.1.1.${packaging.type}
[warn] 	::::::::::::::::::::::::::::::::::::::::::::::
[warn] 	::              FAILED DOWNLOADS            ::
[warn] 	:: ^ see resolution messages for details  ^ ::
[warn] 	::::::::::::::::::::::::::::::::::::::::::::::
[warn] 	:: javax.ws.rs#javax.ws.rs-api;2.1.1!javax.ws.rs-api.${packaging.type}
[warn] 	::::::::::::::::::::::::::::::::::::::::::::::
[error] sbt.librarymanagement.ResolveException: download failed: javax.ws.rs#javax.ws.rs-api;2.1.1!javax.ws.rs-api.${packaging.type}

@vvcephei
Copy link
Copy Markdown
Contributor Author

vvcephei commented Jan 10, 2019

once merged, we should cherry-pick this back to 2.0 (the first version in which we published a scala artifact).

Copy link
Copy Markdown
Member

@bbejeck bbejeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this @vvcephei. LGTM

@guozhangwang guozhangwang merged commit b4bf623 into apache:trunk Jan 10, 2019
guozhangwang pushed a commit that referenced this pull request Jan 10, 2019
As documented in https://issues.apache.org/jira/browse/KAFKA-7741,
the javax dependency we receive transitively from connect is incompatible
with SBT builds.

Streams doesn't use the portion of Connect that needs the dependency,
so we can fix the builds by simply excluding it.

Reviewers: Bill Bejeck <bill@confluent.io>, Guozhang Wang <guozhang@confluent.io>
guozhangwang pushed a commit that referenced this pull request Jan 10, 2019
As documented in https://issues.apache.org/jira/browse/KAFKA-7741,
the javax dependency we receive transitively from connect is incompatible
with SBT builds.

Streams doesn't use the portion of Connect that needs the dependency,
so we can fix the builds by simply excluding it.

Reviewers: Bill Bejeck <bill@confluent.io>, Guozhang Wang <guozhang@confluent.io>
@guozhangwang
Copy link
Copy Markdown
Contributor

LGTM! Merged to trunk, and cherry-picked to 2.1 and 2.0.

@vvcephei
Copy link
Copy Markdown
Contributor Author

Thanks @guozhangwang and @bbejeck !

@vvcephei vvcephei deleted the KAFKA-7741-exclude-javax branch January 11, 2019 00:23
pengxiaolong pushed a commit to pengxiaolong/kafka that referenced this pull request Jun 14, 2019
As documented in https://issues.apache.org/jira/browse/KAFKA-7741,
the javax dependency we receive transitively from connect is incompatible
with SBT builds.

Streams doesn't use the portion of Connect that needs the dependency,
so we can fix the builds by simply excluding it.

Reviewers: Bill Bejeck <bill@confluent.io>, Guozhang Wang <guozhang@confluent.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants