繁体   English   中英

couchbase Java客户端1.2。*因Maven依赖关系而失败

[英]couchbase java client 1.2.* fails with maven dependency

我正在尝试按照本教程创建一个基本的java-couchbase hello world应用程序。

向我的pom.xml添加了以下依赖项:

<dependencies>
    <dependency>
        <groupId>couchbase</groupId>
        <artifactId>couchbase-client</artifactId>
        <version>1.2.1</version>
    </dependency>
    <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>2.2.2</version>
    </dependency>
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-web-api</artifactId>
        <version>6.0</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

但是然后我的pom.xml中出现了这个错误:

ArtifactDescriptorException: Failed to read artifact descriptor for
couchbase:couchbase-client:jar:1.2.1: ArtifactResolutionException: 
Failure to transfer couchbase:couchbase-client:pom:1.2.1 from 
http://repo.maven.apache.org/maven2 was cached in the local 
repository, resolution will not be reattempted until the update interval 
of central has elapsed or updates are forced. Original error: Could 
not transfer artifact couchbase:couchbase-client:pom:1.2.1 from/to 
central (http://repo.maven.apache.org/maven2): null to 
http://repo.maven.apache.org/maven2/couchbase/couchbase-client/1.2.1/couchbase-client-1.2.1.pom

我可以看到罐子存在于Maven集中分发中 ,我不明白为什么会收到此错误以及如何解决该错误。

对于错误,该异常非常简单:

Failure to transfer couchbase:couchbase-client:pom:1.2.1 from 
http://repo.maven.apache.org/maven2 was cached in the local repository

然后,它说明了解决该问题应采取的措施:

resolution will not be reattempted until the update interval of central has 
elapsed or updates are forced. 

为了FORCE更新,请使用参数-U

 -U,--update-snapshots    Forces a check for updated
                          releases and snapshots on remote
                          repositories

从mvn --help选项。

为解决此问题做了两件事:

  1. 从我的maven settings.xml文件中注释掉了proxy部分( 此线程之后 )。
  2. 改变了我的依赖性。 旧版本使用了Maven 2回购协议:

     <dependency> <groupId>couchbase</groupId> <artifactId>couchbase-client</artifactId> <version>1.2.3</version> </dependency> 

此链接之后 ,将其替换为:

    <dependency>
        <groupId>com.couchbase.client</groupId>
        <artifactId>couchbase-client</artifactId>
        <version>1.2.3</version>
    </dependency>

点击您的项目。

右键单击>团队>与存储库同步。

那应该同步起来。

如果不起作用,请右键单击>运行方式> Maven构建。 如果弹出,则在“干净安装-DskipTests = true”中显示“目标”之后的屏幕。 基本上是说我想进行全新安装,而您想跳过测试。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM