简体   繁体   English

如何在 VS Code 中为简单的 Java 项目(即没有任何构建工具的非托管文件夹)添加 Maven 依赖项?

[英]How do I add a Maven dependency in VS Code for a simple Java project (i.e. an unmanaged folder without any build tools)?

I'm trying to build an AI model for the Mario-AI-Framework using the Deep Java Library (DJL).我正在尝试使用Deep Java 库(DJL) 为Mario-AI-Framework构建一个 AI model。 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 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是的,我能找到的关于如何导入这个东西的唯一信息是使用Maven或者他们使用Gradle从源代码构建它。 I'm not used to working with Java projects and importing libraries so I'm at a complete lost here.我不习惯使用 Java 项目和导入库,所以我完全迷失在这里。 If anyone could point me in the right direction I would appreciate it.如果有人能指出我正确的方向,我将不胜感激。

You can always download the jar files stored in the Maven repository and put them manually on your classpath.您始终可以下载存储在 Maven 存储库中的 jar 文件,并手动将它们放在您的类路径中。

Remember to do so recursively for all artifacts referred to until you have all the jar files that Maven would have downloaded for you.请记住对所有引用的工件递归执行此操作,直到您拥有 Maven 会为您下载的所有 jar 文件。

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.例如,如果您需要 commons lang,您可以从https://search.maven.org/artifact/org.mod4j.org.apache.commons/lang/2.1.0/jar获得 2.1 - 请注意右上角的下载链接.

You might find it easier to rework what you have into being a Maven project, so your tooling does it for you.您可能会发现将现有内容重新加工成 Maven 项目会更容易,因此您的工具会为您完成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在没有多重继承的情况下避免代码重复(即在 Java 中)? - How do I avoid code duplication without multiple inheritance (i.e. in java)? 我如何用Maven构建这个Java项目? - How do I build this java project with maven? Maven Java API:独立依赖性解析(即不是Maven插件) - Maven Java API : Standalone Dependency Resolution (i.e. not a Maven plugin) 如何在 Eclipse 中添加对另一个现有项目的 Maven 依赖项 - how do I add a Maven dependency on another existing project in Eclipse 如何创建一个在运行时接受选项的Java项目(即-p或-f) - How do I create a java project that takes options at runtime (i.e. -p or -f) 如何在Maven Java项目的源文件夹中添加图像? - How can i add images in source folder of a Maven Java Project? 我如何阅读(即理解)此Java数组? - How do I read (i.e. understand) this Java array? 如何在 VS Code 中调试 Maven 项目? - How do I debug a Maven project in VS Code? 如何使用Gradle构建作为根项目依赖项的Maven项目? - How can I build a Maven project, as a dependency to the root project, with Gradle? 如何为 Intellij 和/或 VS Code 添加依赖项/第三方 java 库到 Maven 中? - How do I add dependencies/3rd party java libraries into Maven for Intellij and/or VS Code?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM