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

Using http-request plugin in integration tests fails due to wrong Guava version #102

Open
kleini opened this issue Jul 10, 2020 · 5 comments
Labels
Milestone

Comments

@kleini
Copy link

kleini commented Jul 10, 2020

Jenkins core still uses Guava 11:
https://github.com/jenkinsci/jenkins/blob/d4690b20f9dc170f7657c6b36df2c0d48a217ebe/bom/pom.xml#L42

My integration test uses http-request-plugin 1.8.26. Looking at the dependencies of the Gradle plugin, Guava 18 is used:

$ gradle dependencies | grep guava
|    |    |    |    +--- com.google.guava:guava:11.0.1 -> 18.0
|    +--- com.google.guava:guava:11.0.1 -> 18.0
+--- com.google.guava:guava:18.0
|    |    |    |    +--- com.google.guava:guava:11.0.1 -> 18.0
|    +--- com.google.guava:guava:11.0.1 -> 18.0
+--- com.google.guava:guava:18.0
|    |    |    |    +--- com.google.guava:guava:11.0.1 -> 18.0
|    +--- com.google.guava:guava:11.0.1 -> 18.0
+--- com.google.guava:guava:18.0
|    |    |    |    +--- com.google.guava:guava:11.0.1 -> 18.0
|    +--- com.google.guava:guava:11.0.1 -> 18.0
+--- com.google.guava:guava:18.0
     |    |    |    +--- com.google.guava:guava:11.0.1
     +--- com.google.guava:guava:11.0.1 (*)
+--- com.google.guava:guava:18.0 (n)
|    |    |    |    +--- com.google.guava:guava:13.0.1 -> 18.0
|    |         |    +--- com.google.guava:guava:11.0.1 -> 18.0
|    |         |    |    |    +--- com.google.guava:guava:14.0 -> 18.0
|    |         +--- com.google.guava:guava:11.0.1 -> 18.0
|    +--- com.google.guava:guava:18.0
     |    |    |    |    +--- com.google.guava:guava:11.0.1
     |    +--- com.google.guava:guava:11.0.1
|    |    |    |    +--- com.google.guava:guava:11.0.1 -> 18.0
|    +--- com.google.guava:guava:11.0.1 -> 18.0
+--- com.google.guava:guava:18.0
|    |    |    |    +--- com.google.guava:guava:11.0.1 -> 18.0
|    +--- com.google.guava:guava:11.0.1 -> 18.0
|    |    \--- com.google.guava:guava:11.0.1 -> 18.0
+--- com.google.guava:guava:18.0
|    |    |    |    +--- com.google.guava:guava:11.0.1 -> 18.0
|    +--- com.google.guava:guava:11.0.1 -> 18.0
|    |    \--- com.google.guava:guava:11.0.1 -> 18.0
+--- com.google.guava:guava:18.0

Guava 18 does not contain com.google.common.collect.Ranges any more and my integration test using http-request-plugin fails to import that class. See https://github.com/jenkinsci/http-request-plugin/blob/eb45bd7e963903f355c22377266fe907c9ea45f7/src/main/java/jenkins/plugins/http_request/HttpRequest.java#L27

@kleini
Copy link
Author

kleini commented Jul 10, 2020

Found the cause of my problem

    pluginDependencies {
        dependency("org.jenkins-ci.plugins", "jira", "3.1.1") // has dependency to guava 18.0
    }

downgrading that plugin to 3.0.9 solves my dependency problem.

@kleini
Copy link
Author

kleini commented Jul 10, 2020

@basil
Copy link

basil commented Aug 7, 2020

I was able to work around this issue without downgrading any plugins by adding the following to build.gradle:

dependencies {
  integrationTestImplementation enforcedPlatform("org.jenkins-ci.main:jenkins-bom:${jenkinsVersion}")
}

(Here, jenkinsVersion is the version of Jenkins core I am using.)

The Jenkins core BOM defines the old versions of Groovy and Guice used by Jenkins core. By importing this BOM using enforcedPlatform, the versions defined in the BOM override the newer versions found in the dependency graph. Note that you must be using Gradle 5.0 or later to be able to import Maven BOMs.

@mkobit mkobit added the bug label Aug 10, 2020
@mkobit mkobit added this to the 0.11.0 milestone Aug 10, 2020
@kleini
Copy link
Author

kleini commented Feb 9, 2021

#65 (comment) solved my issues with latest plugins and Jenkins pipeline tests.

@mkobit mkobit modified the milestones: 0.11.0, 1.0.0 Oct 26, 2023
@mkobit
Copy link
Owner

mkobit commented Oct 26, 2023

I'll look to make use of enforcedPlatform for the Jenkins BOM or some other dependency maneuvering to ensure runtime compatibility in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants