简体   繁体   English

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

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

I'm trying to create a basic java-couchbase hello world application following this tutorial . 我正在尝试按照本教程创建一个基本的java-couchbase hello world应用程序。

Added the following dependencies to my pom.xml: 向我的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>

But then I get an this error in my pom.xml: 但是然后我的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

I can see that the jars exist in maven central distribution , I don't understand why I am getting this error and how can I get over it. 我可以看到罐子存在于Maven集中分发中 ,我不明白为什么会收到此错误以及如何解决该错误。

The exception is pretty straight forward on the error: 对于错误,该异常非常简单:

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

Then it says what should be done to fix the issue: 然后,它说明了解决该问题应采取的措施:

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

In order to FORCE the update use the parameter -U 为了FORCE更新,请使用参数-U

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

From mvn --help option. 从mvn --help选项。

Did 2 things to resolve this issue: 为解决此问题做了两件事:

  1. Commented out the proxy section from my maven settings.xml file (following this thread ). 从我的maven settings.xml文件中注释掉了proxy部分( 此线程之后 )。
  2. Changed my dependency. 改变了我的依赖性。 The old one used maven 2 repo: 旧版本使用了Maven 2回购协议:

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

Following this link , replaced it with: 此链接之后 ,将其替换为:

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

Click on your project. 点击您的项目。

Right click > Team > Synchronize with Repository. 右键单击>团队>与存储库同步。

That should sync things up. 那应该同步起来。

If that does not work Right click > Run As > Maven Build. 如果不起作用,请右键单击>运行方式> Maven构建。 If it pops up a screen that says "goal" past this in "clean install -DskipTests=true". 如果弹出,则在“干净安装-DskipTests = true”中显示“目标”之后的屏幕。 It's basically saying I want to do an clean installation and you want to skip the tests. 基本上是说我想进行全新安装,而您想跳过测试。

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

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