-
Notifications
You must be signed in to change notification settings - Fork 8
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
Spring 6+ upgrades trigger migration to HttpClient 5 – how to deal with undeclared dependency on HttpClient 4? #35
Comments
hi! Thanks for reporting this issue; it appears indeed an oversight for transitive dependencies; might help to add an rewrite-apache/src/main/resources/META-INF/rewrite/apache-httpclient-5.yml Lines 21 to 48 in 6dd876d
If we add an appropriate |
The following seems to work if applied before the upgrade: - org.openrewrite.maven.AddDependency:
groupId: org.apache.httpcomponents
artifactId: httpclient
version: '*'
onlyIfUsing: org.apache.http..*
acceptTransitive: false I had a hard time figuring out about the Unfortunately, the I suppose the same would be needed for Gradle. On our side, I realized that our usage is sometimes together with JMeter/jmeter-java-dsl, and they still depend on HttpClient4, so we can’t really do the upgrade anyway in those cases. |
Ah sorry to hear that I wonder if we should instead add |
That’s not really the place I would look for for package patterns 😅 I actually found the answer through debugging, seeing that it uses
Not for the moment as it does not solve our issue – switching to HttpClient5 even though it’s actually not compatible with the API we are using. In fact I wonder if it wouldn’t be good to revert openrewrite/rewrite-spring#566. I don’t find it very safe since it can’t detect whether the code will work with HttpClient5. I could create a PR for that if desired. Of course there is the problem that SB 3.1 also removes the dependency management for HttpClient4, as described in that PR. Maybe only the code that uses it together with |
Discussed in openrewrite/rewrite#4584
Originally posted by @DidierLoiseau October 16, 2024
I noticed an issue with this migration, which is triggered transitively by Spring Boot 3+ upgrades since openrewrite/rewrite-spring#566: HttpClient 4 is a relatively common dependency, so people often use it without even realizing it is pulled transitively by another dependency, and they don’t declare HttpClient as an explicit dependency.
The problem with this migration is that it will update the code without adding the HttpClient 5 dependency if HttpClient 4 was missing.
Is there a way around this?
The text was updated successfully, but these errors were encountered: