Home > database >  How do I add a Maven dependency in VS Code for a simple Java project (i.e. an unmanaged folder witho
How do I add a Maven dependency in VS Code for a simple Java project (i.e. an unmanaged folder witho

Time:03-14

I'm trying to build an AI model for the Mario-AI-Framework using the Deep Java Library (DJL). I'm using VS Code with the Java extension, as this is part of a larger project, mainly in Python. Now I have a Pytorch model trained and ready to go but I need the DJL Pytorch engine to load it in Java. The problem is, the only info I can find on how to import this thing uses Maven or they build it from source using Gradle. I'm not used to working with Java projects and importing libraries so I'm at a complete lost here. If anyone could point me in the right direction I would appreciate it.

CodePudding user response:

You can always download the jar files stored in the Maven repository and put them manually on your classpath.

Remember to do so recursively for all artifacts referred to until you have all the jar files that Maven would have downloaded for you.

For instance if you need commons lang you can get 2.1 from https://search.maven.org/artifact/org.mod4j.org.apache.commons/lang/2.1.0/jar - note the Downloads link in the upper right.

You might find it easier to rework what you have into being a Maven project, so your tooling does it for you.

  • Related