如何在不使用Maven的情况下,在Java程序中引入swagger-parser?

huangapple go评论71阅读模式
英文:

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目录中。

  1. 转到Maven Central中的swagger-parser页面:https://mvnrepository.com/artifact/io.swagger.parser.v3/swagger-parser
  2. 单击您想要的版本(很可能是最新的版本:2.0.21)。
  3. 在顶部的Files部分,单击jar以下载JAR文件。
  4. 滚动到下一个标记为Compile Dependencies的表格。
  5. 对于其中的每个条目,单击版本号。
  6. 现在您将不得不递归从第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.

  1. Go to the swagger-parser page in Maven Central: https://mvnrepository.com/artifact/io.swagger.parser.v3/swagger-parser
  2. Click on the version you want (most likely the most current one: 2.0.21).
  3. At the top where it says Files click on jar to download the JAR file.
  4. Scroll down to the next table which is labeled Compile Dependencies.
  5. For each of the entries in there click on the version number.
  6. 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.

huangapple
  • 本文由 发表于 2020年9月14日 14:47:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/63879312.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定