Reputation: 2552
I'm trying to connect to a Cloudant client, and I've taken an example of code that I've found on GitHub.
public ClientBuilder getCloudantClient(String username, String password) {
ClientBuilder clientBuilder = ClientBuilder.account(username).
username(username).password(password);
return clientBuilder;
}
Ideally, once that method returns, I try to build and return the database by doing:
CloudantClient client = (CloudantClient) cloudantRestClient.getCloudantClient(USERNAME, PASSWORD).build();
Database database = client.database(DATABASE, true);
But for some reason, I'm getting a compile error:
The method account(String) is undefined for the type ClientBuilder
My pom.xml dependencies for Cloudant and JUnit tests is as follows:
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.cloudant</groupId>
<artifactId>cloudant-client</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.19</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>2.22.1</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.10.19</version>
</dependency>
I'm not sure where I'm going wrong. Is this the correct way to go with this?
Upvotes: 1
Views: 863
Reputation: 41123
You imported wrong ClientBuilder, check it's indeed com.cloudant.client.api.ClientBuilder
Upvotes: 2