如何使Eclipse停止要求在新的Java项目创建时创建module-info Java文件? [英] How to get Eclipse to stop asking to create a module-info java file on new Java project creation?

查看:3200
本文介绍了如何使Eclipse停止要求在新的Java项目创建时创建module-info Java文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次我尝试创建一个新的Java项目Eclipse一直询问我是否要将模块信息Java文件添加到源文件夹中。由于没有立即显而易见的选项退出此检查,这变得非常烦人。

Everytime I try to create a new java project Eclipse keeps asking if I want to add a module-info java file to the source folder. It's getting pretty annoying as there's no immediately obvious option to opt out of this check.

IDE for Java Developers,Photon版本4.8.0

IDE for Java Developers, Photon release 4.8.0

推荐答案

在创建新项目时查看,请在第一个对话框新Java项目上单击下一步。单击>>完成时,将弹出另一个对话框。它将带您进入第三个对话框,要求创建module-info java文件? &给您两个选择create&不要创造。
您应该选择不要创建。

See while creating a new project, after you click>> next on the very first dialog "new java project." There is one another dialog box pops up when you click >> finish. It will lead you to the 3rd dialog box which asks for the creation of module-info java file?? & gives you two option create & don't create. You should select "don't create."

以下是文件
module-info的一些优点.java内容:
要将jar文件声明为命名模块,需要提供一个module-info.class文件,该文件自然是从module-info.java文件编译而成的。它声明了模块系统内的依赖关系,并允许编译器和运行时管理应用程序中模块之间的边界/访问冲突。让我们看一下文件语法和可以使用的关键字。

Here are some advantages of the file module-info.java contents: To declare a jar file as a named module, one needs to provide a module-info.class file, which is, naturally, compiled from a module-info.java file. It declares the dependencies within the module system and allows the compiler and the runtime to police the boundaries/access violations between the modules in your application. Let’s look at the file syntax and the keywords you can use.


  • 模块module.name –声明一个名为module.name的模块。
  • Module module.name – declares a module called module.name.
  • Requires module.name – specifies that our module depends on the module module.name, allows this module to access public types exported in the target module.
  • Requires transitive module.name – any modules that depend on this module automatically depend on module.name.
  • Exports pkg.name says that our module exports public members in package pkg.name for every module requiring this one.
  • Exports pkg.name to module.name the same as above, but limits which modules can use the public members from the package pkg.name.
  • Uses class.name makes the current module a consumer for service class.name.
  • Provides class.name with class.name.impl registers class.name.impl class a service that provides an implementation of the class.name service. opens pkg.name allows other modules to use reflection to access the private members of package pkg.name.
  • Opens pkg.name to module.name does the same, but limits which modules can have reflection access to the private members in the pkg.name.

关于module-info.java语法的一件大事是现代IDE将完全支持您编写它们的努力。也许所有这些都可以很好地工作。我知道IntelliJ IDEA确实可以提供内容帮助,当您从不需要的模块中导入类时,可以快速修复模块文件,等等。我毫不怀疑Eclipse IDE和NetBeans IDE是否提供相同的功能。

One great thing about the module-info.java syntax is that the modern IDEs would fully support your efforts of writing them. Perhaps all of them would work beautifully. I know that IntelliJ IDEA does content assist, quick fixes of the module files when you import classes from the module you haven’t required yet, and so on. I don’t doubt Eclipse IDE and NetBeans IDE offer the same.

这篇关于如何使Eclipse停止要求在新的Java项目创建时创建module-info Java文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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