Import org.nuxeo.client.api cannot be resolved

Hi, I try to create a java client nuxeo, I followed this tutorial https://doc.nuxeo.com/nxdoc/java-client/, but i can't import “org.nuxeo.client.api”. it fails with an error : the import org.nuxeo.client.api cannot be resolved. Does anyone have any idea of this error?

Thank you, Amel.

0 votes

1 answers

2441 views

ANSWER



Hi,

Indeed, it's a mistake in our documentation. I will update it.

There's no more api in package declaration, see https://doc.nuxeo.com/nxdoc/java-client/#operation-api , the correct package name for NuxeoClient is org.nuxeo.client.NuxeoClient.

0 votes



Hi, When i run the main class i have an exeption : Exception in thread "main" java.lang.NoSuchMethodError: retrofit2.Retrofit.newBuilder()Lretrofit2/Retrofit$Builder; My main class contains just this code : public class TestRest {

static String url = "http://localhost:8080/nuxeo";



public static void main(String[] args)  {

    NuxeoClient nuxeoClient = new NuxeoClient.Builder()
            .url(url)
            .authentication("Administrator", "Administrator")
            .connect();


    // Fetch the root document
    Document root = nuxeoClient.repository().fetchDocumentRoot();

Is there another missing import ? Thank you for your reply

02/13/2018

Hi,

Next time don't hesitate to give your stack trace, generally ~10-15 lines are enough. Here it seems you don't depend on Retrofit version required by nuxeo-java-client. The client requires retrofit 2.3.0. Do you need retrofit in your application ? if not you can remove it from your pom and leveragae transitive dependency with maven.

02/13/2018

Thank you for your reply.
02/16/2018