简体   繁体   中英

couchbase java client 1.2.* fails with maven dependency

I'm trying to create a basic java-couchbase hello world application following this tutorial .

Added the following dependencies to my 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:

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.

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

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

From mvn --help option.

Did 2 things to resolve this issue:

  1. Commented out the proxy section from my maven settings.xml file (following this thread ).
  2. Changed my dependency. The old one used maven 2 repo:

     <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. If it pops up a screen that says "goal" past this in "clean install -DskipTests=true". It's basically saying I want to do an clean installation and you want to skip the tests.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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