Back

[SOLVED] Build Errors in template for Sync with Meilisearch in Java

  • 0
  • Functions
palani
12 Oct, 2023, 18:12

Because when we deploy manually via console it's not taking the package dependencies

TL;DR
User is experiencing build errors in a template for syncing with Meilisearch in Java. Another post was created for the same problem, but it has not been solved yet. User suggests initializing a new project and function to try. Another user suggests running "gradle clean" or "gradle clear" to fix cache errors. User tries this solution but still encounters build errors. User receives an error related to a duplicate entry module and asks for assistance. Another user suggests setting a strategy for handling duplicate modules. User tries this solution and it works. Additionally, there is a code snippet provided for setting query limits and a discussion about passing parameters
Danish
12 Oct, 2023, 18:18

using appwrite deploy function

palani
12 Oct, 2023, 19:38

What is the fourth parameter you are passing to the list documents method. What is the nested type you are providing.

palani
12 Oct, 2023, 19:45

@Danish Can you try the below code snippet

import io.appwrite.Client; import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Databases;

Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID

Databases databases = new Databases(client);

databases.listDocuments( "[DATABASE_ID]", "[COLLECTION_ID]", new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); return; }

TypeScript
    Log.d("Appwrite", result.toString());
})

);

palani
12 Oct, 2023, 19:48

You can add your query parameter as the third parameter and provide the callback function as last parameter

palani
12 Oct, 2023, 19:51

Also for setting limit for queties you can try this Query.limit(25)

Danish
13 Oct, 2023, 10:37

It worked

palani
13 Oct, 2023, 10:38

Super

Danish
13 Oct, 2023, 10:38

but got this error on build:

TypeScript
> Task :compileJava
Note: /usr/local/server/src/main/java/io/openruntimes/java/Server.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /usr/local/server/src/main/java/io/openruntimes/java/Server.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

> Task :processResources
> Task :classes
> Task :buildJar FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':buildJar'.
> Entry module-info.class is a duplicate but no duplicate handling strategy has been set. Please refer to https://docs.gradle.org/7.5.1/dsl/org.gradle.api.tasks.Copy.html#org.gradle.api.tasks.Copy:duplicatesStrategy for details.
Danish
13 Oct, 2023, 10:39

not able to view the result so not sure it worked perfectly or not

palani
13 Oct, 2023, 10:39

Did you write any custom logic for gradle

palani
13 Oct, 2023, 10:40

It is saying entry module is duplicate. Can you check if you have two main methods or just one method

Danish
13 Oct, 2023, 10:41

no, just one Main.java file with one main method

Danish
13 Oct, 2023, 10:42

wrote nothing, just the deps in deps.gradle file

palani
13 Oct, 2023, 10:42

Ok

palani
13 Oct, 2023, 10:44

Answer from StackOverflow : Looks like a cache error (with kotlin) to me. Running gradle clean or gradle clear (not sure which is the right spelling, sorry, one of these should exist as a gradle task) and rebuilding should fix the error, because all files in cache will be deleted by the task and regenerated by the project build.

palani
13 Oct, 2023, 10:44

It's not possible for us to run gradle clean

palani
13 Oct, 2023, 10:44

Can you initialise a new project and a new function and try this

Danish
13 Oct, 2023, 10:45

sure

Danish
13 Oct, 2023, 10:48

still the same build err

palani
14 Oct, 2023, 13:55

Hi @Danish were you able to solve it?

Danish
14 Oct, 2023, 14:10

no not yet

Drake
15 Oct, 2023, 04:03

Looks like you have another post for this problem so I'm closing this one

Drake
15 Oct, 2023, 04:03

[SOLVED] Build Errors in template for Sync with Meilisearch in Java

Drake
15 Oct, 2023, 04:03
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more