Maven 嵌入式部署不适用于 org.apache.httpcomponents.httpclient 4.4 版

Maven embedded deploy not working with org.apache.httpcomponents.httpclient version 4.4

在我的应用程序中,我必须以编程方式 (mvn) 部署工件。我在 maven-embedder 工件和一些非常简单的代码的帮助下完成了这项工作:

MavenCli client = new MavenCli();
int result = client.doMain(new String[] { "deploy" }, "C:/some/path/to/my/pom", System.out, System.out);

为了能够做到这一点,我必须将以下依赖项添加到我的 pom 中:

<dependency>
  <groupId>org.apache.maven</groupId>
  <artifactId>maven-embedder</artifactId>
  <version>3.2.5</version>
</dependency>
<dependency>
  <groupId>org.eclipse.aether</groupId>
  <artifactId>aether-connector-basic</artifactId>
  <version>1.0.2.v20150114</version>
</dependency>
<dependency>
  <groupId>org.eclipse.aether</groupId>
  <artifactId>aether-transport-wagon</artifactId>
  <version>1.0.2.v20150114</version>
</dependency>
<dependency>
  <groupId>org.apache.maven.wagon</groupId>
  <artifactId>wagon-http</artifactId>
  <version>2.8</version>
</dependency>
<dependency>
  <groupId>org.apache.maven.wagon</groupId>
  <artifactId>wagon-provider-api</artifactId>
  <version>2.8</version>
</dependency>
<dependency>
  <groupId>org.apache.httpcomponents</groupId>
  <artifactId>httpclient</artifactId>
  <version>4.3</version>
</dependency>

问题是,当我将 httpclient 的版本更改为 4.4 版(最新版本)时,我在尝试部署时遇到以下错误:

4840 [main] WARN Sisu  - Error injecting:   org.apache.maven.wagon.providers.http.HttpWagon
    java.lang.NoClassDefFoundError: org/apache/http/ssl/TrustStrategy
    at java.lang.ClassLoader.defineClass1(Native Method)
    ...
Caused by: java.lang.ClassNotFoundException:   org.apache.http.ssl.TrustStrategy
    at java.net.URLClassLoader.run(URLClassLoader.java:372)   
    ... 72 more

有人知道为什么部署在 org.apache.httpcomponents.httpclient 的版本 4.3.x 上工作正常而在版本 4.4 上失败吗?

我怀疑是HttpCore的版本? HttpClient 所基于的,仍然解析为 4.3.x。尝试将其明确设置为 4.4

<dependency>
    <groupId>org.apache.httpcomponents</groupId>
    <artifactId>httpcore</artifactId>
    <version>4.4</version>
</dependency>