-
-
Notifications
You must be signed in to change notification settings - Fork 9k
httpclient4依赖改为provided #3844
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
httpclient4依赖改为provided #3844
The head ref may contain hidden characters: "\u8C03\u6574httpclient4\u4E3Aprovided"
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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>
支付模块现在仍然必须使用httpclient4