Back

Java function with local .jar dependency

  • 0
  • Self Hosted
  • Functions
whataboutno13
22 Jan, 2024, 15:44

Hi there, I need to build a java function which uses a custom (not publicly available) jar dependency. I've added the dependency in the build.gradle file like this

TypeScript
    implementation 'io.appwrite:sdk-for-kotlin:4.1.0'
    implementation files('localLibs/costumJARFile.jar')
}```.
I am getting the following error when I deploy the simple starter java function.

Docker Error: Preparing for build ... Building ... Compiling ... Downloading https://services.gradle.org/distributions/gradle-7.5.1-bin.zip ...........10%............20%...........30%............40%...........50%............60%...........70%............80%...........90%............100%

Welcome to Gradle 7.5.1!

Here are the highlights of this release:

  • Support for Java 18
  • Support for building with Groovy 4
  • Much more responsive continuous builds
  • Improved diagnostics for dependency resolution

For more details see https://docs.gradle.org/7.5.1/release-notes.html

Starting a Gradle Daemon (subsequent builds will be faster)

FAILURE: Build failed with an exception.

  • Where: Build file '/usr/local/server/build.gradle' line: 7
  • What went wrong: A problem occurred evaluating root project 'java-runtime'.

    Cannot invoke method apply() on null object

  • Try:

    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 53s

TypeScript

`[...]build.gradle line: 7` describes the start of the `dependencies` part. Is it possible to deploy custom jars to appwrite functions?
Thanks for your help! :appwritecheers:
TL;DR
Title: Java function with local .jar dependency Summary: The developer is trying to build a Java function with a local .jar dependency. They added the dependency in the `build.gradle` file but encounter an error when deploying. They are asking if it's possible to deploy custom jars to Appwrite functions. Solution: It seems that there is an issue with the `build.gradle` file. The error message suggests that there might be a problem with `apply()` on a null object. The developer should check the syntax and configuration of their `build.gradle` file to ensure it is correct. They can also try running the build with the
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