gpt4 book ai didi

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

转载 作者:搜寻专家 更新时间:2023-10-31 19:51:35 26 4
gpt4 key购买 nike

我目前正在尝试创建一个基本的 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 中使用 File > New Project... > Java > Java Application 创建项目,则应使用 File > New Project... > 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 中,您使用 File > New Project... > Java EE > ... 创建了一个 Java Enterprise 项目,但在 NetBeans 11.0 中,这已更改为 File >新建项目...> Java 和 Ant > Java Enterprise > ...

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

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com