httpclient4依赖改为provided#3844
Merged
binarywang merged 3 commits intobinarywang:developfrom Jan 10, 2026
Hidden character warning
The head ref may contain hidden characters: "\u8c03\u6574httpclient4\u4e3aprovided"
Merged
Conversation
支付模块现在仍然必须使用httpclient4
🤖 Augment PR SummarySummary: Adjusts Maven dependency scopes so Apache HttpClient 4 is no longer pulled in transitively by default, while keeping payment support intact. Changes:
Technical Notes: This shifts HttpClient 4 to an “opt-in” dependency model for most modules; consumers may need to declare the desired HTTP client explicitly. 🤖 Was this summary useful? React with 👍 or 👎 |
There was a problem hiding this comment.
Pull request overview
本 PR 旨在将 httpclient4 依赖的 scope 从默认的 compile 改为 provided,以便让使用者可以更灵活地选择 HTTP 客户端实现。主要变更包括:
- 将 weixin-java-common 及大部分 SDK 模块的 httpclient4 依赖改为 provided scope
- weixin-java-pay 模块保持 httpclient4 为 compile scope(因为支付模块部分接口仍必须使用 httpclient4)
- 升级 httpclient5 版本从 5.5 到 5.5.2
- 更新文档说明依赖变更的影响
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| pom.xml | 升级 httpclient5 版本从 5.5 到 5.5.2 |
| weixin-java-common/pom.xml | 将 httpclient 和 httpmime 依赖的 scope 改为 provided |
| weixin-java-pay/pom.xml | 显式添加 httpclient 和 httpmime 依赖(保持默认 compile scope) |
| weixin-java-mp/pom.xml | 添加 httpclient 和 httpmime 依赖,scope 为 provided |
| weixin-java-miniapp/pom.xml | 添加 httpclient 和 httpmime 依赖,scope 为 provided |
| weixin-java-cp/pom.xml | 添加 httpclient 依赖,scope 为 provided(缺少 httpmime) |
| weixin-java-open/pom.xml | 添加 httpclient 和 httpmime 依赖,scope 为 provided |
| weixin-java-channel/pom.xml | 添加 httpclient 和 httpmime 依赖,scope 为 provided |
| weixin-java-qidian/pom.xml | 添加 httpclient 依赖,scope 为 provided(缺少 httpmime) |
| docs/HTTPCLIENT_UPGRADE_GUIDE.md | 更新文档以反映依赖变更和使用说明 |
Comments suppressed due to low confidence (1)
docs/HTTPCLIENT_UPGRADE_GUIDE.md:121
- 文档中关于排除依赖的示例可能会误导用户。由于此 PR 将大多数模块的 httpclient4 依赖改为 provided scope,这些模块(如 weixin-java-mp)默认不会传递 httpclient4 依赖。因此,对于这些模块,用户不需要显式排除 httpclient4,因为它已经是 provided scope。
这个排除示例仅适用于 weixin-java-pay 模块,因为只有 pay 模块保持了 httpclient4 作为 compile 依赖(默认 scope)。建议:
- 明确说明这个排除示例主要针对 weixin-java-pay 模块
- 或者提供针对不同模块的不同处理说明
### Q: 如何排除不需要的依赖?
A: 如果只想使用一个版本,可以在 `pom.xml` 中排除另一个:
```xml
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-mp</artifactId>
<version>最新版本</version>
<exclusions>
<!-- 排除 HttpClient 4.x -->
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
</exclusion>
</exclusions>
</dependency>
</details>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
支付模块现在仍然必须使用httpclient4