2

I created my first Azure Function in Java because I would need to use a specific external jar file. I am working in VS Code and I have found a short reference in the docs on using external libraries. Third-party libraries.

However I don't get the import to work. It would be great to have an example of a VS Code Java Azure Functions project using external libraries or a more detailed step by step documentation.

4
  • 1
    checkout this repo for sample: github.com/yoshioterada/Azure-Functions-For-Java-Sample Commented Mar 4, 2019 at 16:56
  • @KetanChawda-MSFT thank you very much. I am working with VS Code using the Azure Functions extension and Java Extension Pack. I tried to follow the first step in your reference but I don't seem to be able to install the jar file I need to work with. I have no prior experience with java projects or maven. Do you have an even more basic reference? Do you know if there is a way to add the jar reference with the tooling in VS Code? Commented Mar 4, 2019 at 17:37
  • 1
    In a maven project, all the dependencies are handled by pom.xml. We can use either maven repositories to download the dependencies or you can add it from your local directory. The following can be done install jar to local maven repository. Checkout this link for reference : maven.apache.org/general.html#importing-jars Commented Mar 5, 2019 at 5:06
  • 1
    also checkout this SO post : stackoverflow.com/questions/4955635/… Commented Mar 5, 2019 at 5:13

1 Answer 1

1

In a maven project, all the dependencies are handled by pom.xml. We can use either maven repositories to download the dependencies or you can add it from your local directory. The following can be done install jar to local maven repository.

References: http://maven.apache.org/general.html#importing-jars https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html

mvn install:install-file
  -Dfile=<path-to-file>
  -DgroupId=<group-id>
  -DartifactId=<artifact-id>
  -Dversion=<version>
  -Dpackaging=<packaging>
  -DgeneratePom=true

Where: <path-to-file>  the path to the file to load
       <group-id>      the group that the file should be registered under
       <artifact-id>   the artifact name for the file
       <version>       the version of the file
       <packaging>     the packaging of the file e.g. jar
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.