英文:
How to include swagger-parser in Java program without Maven?
问题
我想在Java中使用swagger-parser,以便可以解析JSON或YAML文件以提取所需信息。我将其用作Java程序/应用,而不是在服务器或Spring Boot上使用。我已经搜索了很多,但安装过程中都涉及Maven。是否有人可以帮助我解决如何安装并将swagger-parser与Java程序集成的问题(最好是本地安装)?
谢谢。
英文:
I want to include swagger-parser in Java, so that I can parse JSON or YAML files to extract the required information. I am using it as a JAVA program/application and not on a server or Springboot. I have googled a lot, but the installations required Maven. Could someone help with how I can install and integrate the swagger-parser with JAVA program please (preferably local installation)?
Thank you.
答案1
得分: 1
我不熟悉swagger-parser,但在这种情况下,您需要下载swagger-parser JAR文件以及其依赖项的JAR文件(可能有几十个),然后将它们放入项目的lib目录中。
- 转到Maven Central中的swagger-parser页面:https://mvnrepository.com/artifact/io.swagger.parser.v3/swagger-parser
- 单击您想要的版本(很可能是最新的版本:2.0.21)。
- 在顶部的Files部分,单击
jar
以下载JAR文件。 - 滚动到下一个标记为Compile Dependencies的表格。
- 对于其中的每个条目,单击版本号。
- 现在您将不得不递归从第3步开始,下载每个JAR文件,然后逐个下载它们的编译依赖项。
正如我所说,这可能会有数十个文件,因此这将是一项繁重的工作,所以您可能希望考虑学习Maven并使用它,因为它将为您完成所有的下载工作。
英文:
I'm not familiar with swagger-parser, however in cases like these you'll need to download the swagger-parser JAR file and the JAR files of its dependencies (this will be probably into the dozens) and put then into the lib directory of your project.
- Go to the swagger-parser page in Maven Central: https://mvnrepository.com/artifact/io.swagger.parser.v3/swagger-parser
- Click on the version you want (most likely the most current one: 2.0.21).
- At the top where it says Files click on
jar
to download the JAR file. - Scroll down to the next table which is labeled Compile Dependencies.
- For each of the entries in there click on the version number.
- Now you will have to recursively repeat starting from step 3 to download each JAR file and in turn their compile dependencies.
As I said this will probably be dozens of files, so this will be a lot of work, so you may want to consider learning about Maven and using it, because it will do all the downloads for you.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论