如何在Netbeans中创建Java项目,而不使用Maven作为默认项目? [英] How to create Java project in Netbeans, without using Maven as default?

查看:788
本文介绍了如何在Netbeans中创建Java项目,而不使用Maven作为默认项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试创建一个基本的Java项目.出现的第一个选项是"Java with Maven",我已经使用过,但是没有给我所需的创建主类"选项.

I'm currently trying to create a basic Java project. The first option that appears is "Java with Maven", which I already used, but isn't giving me the "Create Main Class" option that I need.

我正在使用在Windows 10 x64上运行的Apache Netbeans IDE 11.0. 我花了一整天的时间,更新并安装了我发现的最新JDK版本,但仍然无法使其正常工作.

I'm using Apache Netbeans IDE 11.0, running on Windows 10, x64. I've given it a whole day, updating and installing the most recent JDK versions I found, and still I'm unable to make it work.

我也已经阅读了这个答案,但是它不起作用: 无法在Netbeans 8.2上创建项目

I've also read this answer, but it's not working: Can't create project on Netbeans 8.2

这是我所得到的图像:

感谢您的帮助.

推荐答案

Apache NetBeans 11.0中对项目模板进行了修订,以使Maven项目更加突出.从 Apache NetBeans博客文章:

The project templates were revised in Apache NetBeans 11.0 to give Maven projects greater prominence. From an Apache NetBeans blog post:

在Apache NetBeans中重构项目模板

Apache NetBeans社区中有很多关于 如何最好地表达Apache Maven和Apache Gradle是 同时要了解比Apache Ant更现代的选择 时间并不意味着使用Apache Ant会有任何问题.

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.

以下是我们似乎已达成共识的内容,即全部 将基于Ant的项目模板放入一个单独的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:

使用上述方法,某人不太可能简单地去 不再存在的Java类别,然后以基于Ant的形式结束 项目,无需考虑.默认情况下,Apache的用户 现在鼓励NetBeans考虑使用Apache Maven和Apache Gradle 第一的. 与蚂蚁相关的旧类别仍然存在,以免 完全混淆任何人,只是将其排列在排名较低的"Java 上面还解决了有关"Java EE"的讨论, 也就是说,通过讨论,这里的想法是将类别命名为"Java 企业".

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.

一个异议可能是,如果您是Java的新手, 您将不知道Maven,Gradle或Ant是什么.好吧,那一直 情况就是如此, NetBeans已通过以下方式人为地隐藏了该选择: 有一个简单地命名为"Java"的类别,然后导致每个人 最终完成了基于Ant的项目. 导致基于Maven的项目的简单命名为"Java"的类别是 可能也不正确,也就是说,需要达到谨慎的平衡.

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 Application .

So if you created a project using File > New Project... > Java > Java Application in earlier releases of NetBeans, you should use File > New Project... > Java with Ant > Java Application in NetBeans 11.0.

注意:

  • NetBeans错误报告新建项目向导中的NETBEANS-2040 Maven First 引用.
  • 另请参阅此YouTube视频开始时的讨论《 Apache NetBeans 11.0粗指南》 .
  • >
  • NetBeans 11.0中的其他项目向导更改:
    • 在NetBeans 11.0中,我必须安装Gradle插件(工具>插件>可用插件> Gradle ),以便在项目向导中查看 Java with Gradle . /li>
    • 在早期版本的NetBeans中,您使用文件>新建项目...> Java EE> ... 创建了一个Java Enterprise项目,但是在NetBeans 11.0中,它已更改为文件> New Project ...> Java with Ant> Java Enterprise> ...
    • NetBeans Bug Report NETBEANS-2040 Maven First in New Project Wizard refers.
    • Also see the discussion at the start of this YouTube video The Rough Guide to Apache NetBeans 11.0.
    • Other project wizard changes in NetBeans 11.0:
      • In NetBeans 11.0 I had to install the Gradle plugin (Tools > Plugins > Available Plugins > Gradle) in order to see Java with Gradle in the Project Wizard.
      • In earlier releases of NetBeans you created a Java Enterprise project using File > New Project... > Java EE > ..., but in NetBeans 11.0 this has changed to File > New Project... > Java with Ant > Java Enterprise > ...

      这篇关于如何在Netbeans中创建Java项目,而不使用Maven作为默认项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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