Skip to content

Conversation

@buaazyl
Copy link
Contributor

@buaazyl buaazyl commented Jan 9, 2026

支付模块现在仍然必须使用httpclient4

支付模块现在仍然必须使用httpclient4
@augmentcode
Copy link

augmentcode bot commented Jan 9, 2026

🤖 Augment PR Summary

Summary: Adjusts Maven dependency scopes so Apache HttpClient 4 is no longer pulled in transitively by default, while keeping payment support intact.

Changes:

  • Bumped Apache HttpClient 5 version to 5.5.2 in the parent POM.
  • Changed weixin-java-common’s HttpClient 4 dependencies (httpclient, httpmime) to provided scope.
  • Added explicit provided declarations for HttpClient 4 (and where needed httpmime) in modules that still compile against HttpClient 4 based executors.
  • Ensured weixin-java-pay continues to bring in HttpClient 4 at compile/runtime since it still depends on it.

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 👎

Copy link

@augmentcode augmentcode bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 1 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Copy link

Copilot AI left a 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)。建议:

  1. 明确说明这个排除示例主要针对 weixin-java-pay 模块
  2. 或者提供针对不同模块的不同处理说明
### 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>

@binarywang binarywang merged commit 397bbe0 into binarywang:develop Jan 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants