【问题标题】:Maven can't find httpcomponents-client in repositoryMaven 在存储库中找不到 httpcomponents-client
【发布时间】:2011-04-03 17:03:36
【问题描述】:

我正在尝试将 Apache httpcomponents-client 库添加到我的 Maven 项目中。我已经向 pom.xml 添加了一个依赖项(在 http://mvnrepository.com/artifact/org.apache.httpcomponents/httpcomponents-client/4.1.1 上找到),但是在构建我的 Eclipse 项目时,Maven 无法找到并下载该库。

我做了一个测试项目,除了包含这个库之外什么都不做,以确保它不是导致问题的任何其他设置:

<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>no.gundelsby.test</groupId>
<artifactId>NeedMyPackage</artifactId>
<version>0.1</version>
<dependencies>
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpcomponents-client</artifactId>
        <version>4.1.1</version>
    </dependency>
</dependencies>
</project>

构建这个项目会导致同样的错误。

我测试过的其他东西:

  • 尝试使用 Maven 2.2.1 和 3.0.3 的香草安装进行构建
  • 让朋友在他的电脑上构建了测试项目,以排除我电脑上的本地问题
  • 将版本从 4.1.1 更改为 4.1

几天前我在使用 org.easytesting.fest-swing 时遇到了同样的问题,请参阅下面的 pom 依赖项:

<dependency>
    <groupId>org.easytesting</groupId>
    <artifactId>fest-swing</artifactId>
    <version>1.2.1</version>
</dependency>

【问题讨论】:

    标签: maven repository


    【解决方案1】:

    您不希望 httpcomponents-client 作为依赖项。这只是客户端相关模块的父 pom。我怀疑你实际上想要&lt;artifactId&gt;httpclient&lt;/artifactId&gt;。

    【讨论】:

    • 是的,这确实解决了我的问题。非常感谢:)
    • +10 如果可以的话...我正在使用 search.maven.org 提供的 maven 依赖项并且遇到了同样的问题。我从核心和客户端工件 ID 中删除了“组件-”,然后我就可以得到我需要的罐子了!再次感谢!
    • 写这些工件名称的人一定也是负责 PHP 命名标准的人
    • 我花了 3 小时试图解决这个问题。谢谢!
    【解决方案2】:

    这里有一个简单的解决方案... 它对我来说很棒... 您可以从 Internet 下载 jar 文件并从 netbeans 或其他 IDE 手动添加到项目中。 这里给你一个例子: enter image description here

    在你的电脑中搜索下载的jar enter image description here

    【讨论】:

      猜你喜欢
      • 2011-06-25
      • 1970-01-01
      • 2015-02-17
      • 2014-06-28
      • 1970-01-01
      • 2016-06-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多