如何在三个不同的Java IDE上检查已安装的JAR,外部库等? [英] How do I check installed JARs, external libraries, etc. on three different Java IDEs?

查看:84
本文介绍了如何在三个不同的Java IDE上检查已安装的JAR,外部库等?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经用几种语言编写了程序,并为计算机科学的学生提供了辅导,但是我才开始在MacBook上学习Java。关于这个问题,我很高兴能为我提供解决该问题的可用信息或教程的答案。我有能力理解高级知识。

I've written programs in several languages and have tutored students in computer science, but just starting to learn Java on my MacBook. Regarding this question, I'd be happy with any answer that points me to available information or tutorials that address my question; I'm capable of understanding advanced things.

我一直在寻找适合我的IDE,以及可以与我的学生一起使用的东西,并且尝试了IntelliJ,Eclipse和VS Code。在安装过程中,我安装了外部JAR来提供额外的功能,例如Apache Commons。

I've been searching for the right IDE for me as well as something I can use with my students, and I've tried IntelliJ, Eclipse, and VS Code. Along the way I've installed external JARs to provide extra capabilities, such as Apache Commons.

事情变得令人困惑。我已经忘记了如何在每个IDE中达到当前状态。我想更好地了解如何了解任何给定项目在这些IDE中的每一个上使用的总体Java环境,包括任何外部JAR及其位置。而且我想知道他们是否从Java系统环境中借用了。

Things are getting confusing. I've lost track of how I got to the present state in each IDE. I'd like to understand better how to know the overall Java environment that any given project is using on each of these IDEs, including any external JARs and where they are located. And I'd like to know if they borrow from the Java system environment.

我的目标是了解我自己的系统如何达到当前配置的方式,在逐个项目的基础上更新我的配置,并帮助学生得到匹配的配置。

My goal is to understand how my own system got to the way its currently configured, to update my configuration on a project-by-project basis, and to help my students get a matching configuration.

我还希望以正确的方式(或最简单/最简洁的方式)安装外部JAR的建议。

I'd also like advice on the right way, or simplest/cleanest way, to install external JARs.

推荐答案

所有IDE都需要一种了解项目依赖项的方法。您可以告诉他们自己,也可以让构建工具来做到这一点。

All IDEs need a way to know your project's dependencies. You can either tell them that yourself or let a build tool do that.

手动依赖项处理:通过将jar添加到项目中来进行。这可能是与一个开发人员一起在特定IDE上进行几乎没有依赖性的小型项目时的最快方法。通常,当告诉IDE这个.jar是您项目的依赖项时,IDE会将该引用存储到特定于项目的文件中(例如,在Eclipse中,您可以使用txt编辑器编辑.classpath文件并自己查看依赖项) 。但是,它会将您的应用程序锁定到IDE。大多数IDE都具有跨IDE的导入和迁移支持,但是当将一个依赖项添加到一个依赖项并且必须重复添加到另一个依赖项时,同时使用这两个IDE可能会造成混淆。此外,您的依赖项本身具有依赖项。通过手动添加您的jar,您也有责任查找并下载它们自己的依赖项。

Manual dependency handling: by adding the jars to your project. This is probably the fastest way when working on a small project, with one developer, on a specific IDE, with few dependencies. Usually when telling the IDE that this .jar is a dependency of your project, the IDE stores that reference to a project-specific file (eg. in Eclipse the .classpath file which you can edit with a txt editor and see the dependencies yourself). However, it kind of locks your application to your IDE. Most IDEs have cross-IDE support for import and migration, but using both IDEs at the same time can be confusing when a dependency is added to one and has to be repetitively added to other as well. Furthermore, your dependencies have dependencies on their own. By adding manually your jars you are responsible to find and download their own dependencies as well.

使用构建工具:有3种标准现在使用的工具:带常春藤的Apache Ant Apache Maven Gradle 。它们都在主要的Java IDE中得到支持:IntelliJ IDEA,Eclipse和NetBeans。它们都使用一些额外的特定于构建工具的文件来存储项目的配置,然后配置您的IDE和特定于IDE的文件。这样,您的项目就变得与IDE无关,IDE将依赖项处理外包给了构建工具。这些工具将在本地目录中下载项目的任何直接或传递依赖关系,或者您可以在指定文件夹中编译jar。从中可以看出,Ant是最老的(在Ivy中添加了依赖项处理支持),Maven是在此之后开发的,而Gradle是最新的并且可能是最灵活的。然而,在生产中,Maven是目前最成熟的产品。
查找标准目录布局。如果您坚持这一点,那么使用Maven或Gradle可以更轻松地进行工作/启动。

Use a build tool: There are 3 standard such tools right now: Apache Ant with Ivy, Apache Maven and Gradle. All of them have support in the major IDEs for Java: IntelliJ IDEA, Eclipse and NetBeans. All of them use some extra build-tool specific files to store your project's configuration and subsequently configure your IDE and the IDE-specific files. That way, your project becomes IDE-agnostic, the IDE outsources the dependency handling to the build tool. These tools will download any direct or transitive dependencies of your project in a local directory or you can compile jars in a specified folder. From those, Ant is the oldest (with Ivy adding dependency handling support), Maven was developed after that and Gradle is the newest and probably the most flexible. In production however Maven is by far the most established one right now. It would be also useful to look up the Standard Directory Layout. If you adhere to that, it will be easier to work/start with either Maven or Gradle.

最后,您可以在 Maven-Central ,在其中方便地添加了它们的Ivy / Maven / Gradle脚本,供您在构建工具上使用脚本。在很多情况下,如果您希望手动将.jar也添加为依赖项。

Finally, you can search and find most of the free libraries in Maven-Central where conveniently their Ivy/Maven/Gradle script is added as well for you to use on your build-tool script. In many cases a .jar is provided as well if you prefer to manually add it as a dependency.

关于VS Code,我认为它通过插件支持这些工具,但是我我不确定。

Regarding VS Code, I think it supports these tools through plugins but I'm not sure.

这篇关于如何在三个不同的Java IDE上检查已安装的JAR,外部库等?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆