2013-12-11 33 views
1

我正在尝试创建一个基本的java-couchbase hello world应用程序,其后跟this tutorialcouchbase java客户端1.2。*失败,依赖于maven

增加了以下的依赖,以我的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 

我看到坛子里存在in maven central distribution,我不明白为什么我得到这个错误,我怎么才能克服它。

回答

2

难道两件事情来解决这个问题:

  1. 从我的Maven的settings.xml文件注释掉代理部分(以下this thread)。
  2. 更改了我的依赖关系。旧的一个使用Maven的2回购:

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

this link,以取代它:

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

点击您的项目。

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

应该同步。

如果这不起作用 右键单击>运行方式> Maven构建。如果它在“clean install -DskipTests = true”中弹出一个屏幕,显示“目标”超过此值。这基本上是说我想做一个干净的安装,你想跳过测试。

+0

团队?我没有使用源代码控制,所以我没有看到这是如何相关的。关于运行“clean install -DskipTests = true” - 我无法读取用于couchbase的工件描述符:couchbase-client:jar:1.2.3:无法传输工件couchbase:couchbase-client:pom:1.2.3 from/to central (http://repo.maven.apache.org/maven2):null为http://repo.maven.apache.org/maven2/couchbase/couchbase-client/1.2.3/couchbase-client-1.2.3。 pom:UnresolvedAddressException - > [Help 1] – forhas

4

唯一的例外是非常直截了当的错误:

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选项。