java - 如何在Netbeans中创建Java项目,而不使用默认的Maven?

标签 java maven netbeans windows-10 netbeans-11

我目前正在尝试创建一个基本的 Java 项目。出现的第一个选项是“Java with Maven”,我已经使用过它,但没有提供我需要的“创建主类”选项。

我使用的是 Apache Netbeans IDE 11.0,在 Windows 10 x64 上运行。 我花了一整天的时间来更新和安装我找到的最新 JDK 版本,但仍然无法使其工作。

我也读过这个答案,但它不起作用: Can't create project on Netbeans 8.2

这是我得到的图像:

ProjectWizrdOnNetBeans11

感谢任何帮助,谢谢。

最佳答案

Apache NetBeans 11.0 中对项目模板进行了修订,使 Maven 项目更加突出。来自Apache NetBeans blog post :

Restructuring of Project Templates in Apache NetBeans

There's been lots of discussion in the Apache NetBeans community about how best to express the fact that Apache Maven and Apache Gradle are more modern choices to be aware of than Apache Ant, while at the same time not implying that there's anything wrong with using Apache Ant.

Here's what we seem to have reached consensus around, i.e., move all Ant-based project templates into a separate Ant-specific folder, while putting the other two build systems higher and therefore more prominently in the list:

new project templates

With the above, someone is less likely to simply go to the no-longer-existing Java category and then end up with an Ant-based project, without thinking about it. By default, the user of Apache NetBeans is now encouraged to consider Apache Maven and Apache Gradle first. The old Ant-related categories are still there, so as not to confuse anyone completely, just structured within a lower ranked "Java with Ant" category. The above also solves the discussion re "Java EE", i.e., here the idea, from discussions, is to name the category "Java Enterprise".

At startup, all categories are closed, i.e., none is more prominent initially than any other.

An objection one could have is that, if you're a complete Java newbie, you won't know what Maven, Gradle, or Ant are. Well, that has always been the case and NetBeans has artificially hidden that choice by having a category simply named "Java", which then resulted in everyone ending up with Ant-based projects. To turn that around and have a category simply named "Java" that results in Maven-based projects is probably not right either, i.e., a careful balance needs to be struck.

因此,如果您在早期版本的 NetBeans 中使用文件 > 新建项目... > Java > Java 应用程序 创建了项目,则应使用文件 > 新建项目... > Java在 NetBeans 11.0 中使用 Ant > Java 应用程序

注释:

  • NetBeans 错误报告 NETBEANS-2040 Maven First in New Project Wizard指的是。
  • 另请参阅此 YouTube 视频开头的讨论 The Rough Guide to Apache NetBeans 11.0 .
  • NetBeans 11.0 中的其他项目向导更改:
    • 在 NetBeans 11.0 中,我必须安装 Gradle 插件(工具 > 插件 > 可用插件 > Gradle)才能在项目向导中看到Java with Gradle
    • 在 NetBeans 的早期版本中,您使用文件 > 新建项目... > Java EE > ... 创建了一个 Java Enterprise 项目,但在 NetBeans 11.0 中,这已更改为 文件 >新项目... > Java 与 Ant > Java Enterprise > ...

关于java - 如何在Netbeans中创建Java项目,而不使用默认的Maven?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60251957/

相关文章:

java - 在java中将十进制月份添加到日期

java - Blue Prism 无法突出显示 Java 应用程序组件

java - IntelliJ IDEA 无法导入依赖

java - 使用spring boot生成MySql数据库

java - C#数组[,]转Java,具体数组的概念

java - Spring Data Rest 多对多树投影映射

java - 如何让.properties从Jenkins读取参数

Netbeans 7.3 启动错误

java - 如何使用相对路径在项目文件中使用 FileWriter 创建文件

java.lang.ClassCastException : Cannot cast org. glassfish.web.loader.WebappClassLoader 到 org.osgi.framework.BundleReference