Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Build fails due to transitive dependencies #857

Closed
dbwiddis opened this issue Jul 4, 2023 · 8 comments · Fixed by #861
Closed

[BUG] Build fails due to transitive dependencies #857

dbwiddis opened this issue Jul 4, 2023 · 8 comments · Fixed by #861
Assignees
Labels
bug Something isn't working untriaged

Comments

@dbwiddis
Copy link
Member

dbwiddis commented Jul 4, 2023

What is the bug?

Following merge of opensearch-project/OpenSearch#8434, transitive dependencies between OpenSearch and opensearch-java conflict for Apache Http dependencies.

Execution failed for task ':compileJava'.
> Could not resolve all dependencies for configuration ':compileClasspath'.
   > Conflict(s) found for the following module(s):
       - org.apache.httpcomponents.client5:httpclient5 between versions 5.2.1 and 5.1.4
       - org.apache.httpcomponents.core5:httpcore5 between versions 5.2.2, 5.1.5 and 5.2
       - org.apache.httpcomponents.core5:httpcore5-h2 between versions 5.2.2, 5.1.5 and 5.2

How can one reproduce the bug?

Build latest SDK against latest Opensearch and OpenSearch Client for Java

What is the expected behavior?

Code compiles

Do you have any additional context?

We need to either exclude the transitive dependency or force our own version.

@dbwiddis dbwiddis added bug Something isn't working untriaged labels Jul 4, 2023
@dbwiddis dbwiddis changed the title [BUG] [BUG] Build fails due to transitive dependencies Jul 4, 2023
@owaiskazi19
Copy link
Member

This should be fixed by: opensearch-project/opensearch-java#554

@dbwiddis
Copy link
Member Author

dbwiddis commented Jul 5, 2023

Yeah, and we'll break again next time one updates before the other.

@cwperks
Copy link
Member

cwperks commented Jul 6, 2023

I'm still getting this issue even after the merge of the change in opensearch-java and publishing the latest changes to maven local.

> ./gradlew :dependencyInsight --configuration compileClasspath --dependency org.apache.httpcomponents.core5:httpcore5

org.apache.httpcomponents.core5:httpcore5:5.2.2
+--- org.apache.httpcomponents.core5:httpcore5-h2:5.2.2
|    +--- org.opensearch.client:opensearch-rest-client:3.0.0-SNAPSHOT
|    |    +--- compileClasspath
|    |    \--- org.opensearch.client:opensearch-rest-high-level-client:3.0.0-SNAPSHOT
|    |         \--- compileClasspath
|    +--- org.opensearch.client:opensearch-java:3.0.0-SNAPSHOT
|    |    \--- compileClasspath
|    \--- org.apache.httpcomponents.client5:httpclient5:5.2.1 (requested org.apache.httpcomponents.core5:httpcore5-h2:5.2)
|         +--- org.opensearch.client:opensearch-rest-client:3.0.0-SNAPSHOT (*)
|         \--- org.opensearch.client:opensearch-java:3.0.0-SNAPSHOT (*)
+--- org.opensearch.client:opensearch-java:3.0.0-SNAPSHOT (*)
\--- org.opensearch.client:opensearch-rest-client:3.0.0-SNAPSHOT (*)

I think the most pertinent line is org.apache.httpcomponents.client5:httpclient5:5.2.1 (requested org.apache.httpcomponents.core5:httpcore5-h2:5.2).

httpclient5:5.2.1 is requesting httpcore5-h2:5.2 which mismatches with 5.2.2 being requested elsewhere.

5.2.1 is the latest on maven central: https://mvnrepository.com/artifact/org.apache.httpcomponents.client5/httpclient5

@cwperks
Copy link
Member

cwperks commented Jul 6, 2023

I had to downgrade httpcore5 to 5.2 in both core and opensearch-java to resolve this issue locally.

@reta
Copy link
Contributor

reta commented Jul 6, 2023

@cwperks @dbwiddis I will submit the pull request shorlty

@dbwiddis
Copy link
Member Author

dbwiddis commented Jul 6, 2023

<insert my recurring request for an OpenSearch version catalog here>

@reta
Copy link
Contributor

reta commented Jul 6, 2023

Hehe .... I hear you, may be needs prioritization ,,,

@dbwiddis
Copy link
Member Author

dbwiddis commented Jul 6, 2023

My background in dependency management is with Maven which seems a bit simpler but easier to resolve situations like this (e.g., order matters). Gradle has a lot of hidden switches and priorities that make these harder to diagnose!

I do think for known transitive dependencies that will have recurring conflicts on version updates, a better solution for SDK is to exclude the transitives from one option (e.g., the client) and thus always use the version in the other (e.g, OpenSearch).

Forcing our own version would work but for transitives seems to break some sort of encapsulation concept.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working untriaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants