簡體   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