简体   繁体   English

NetBeans 12 不再管理库

[英]NetBeans 12 doesn't manage libraries anymore

A week ago I upgraded my Java IDE to Netbeans 12 (and JDK 14), and only yesterday I noticed the window Project Properties (MYPROG) lacks of essential functionality ie there are not lines for compiling in *.jar , and mostly there is not any line for adding *.jar libraries, there is instead an empty line for JavaScript libraries, and it is impossible to add them in any other point. A week ago I upgraded my Java IDE to Netbeans 12 (and JDK 14), and only yesterday I noticed the window Project Properties (MYPROG) lacks of essential functionality ie there are not lines for compiling in *.jar , and mostly there is not任何添加*.jar库的行, JavaScript库的行是空行,并且不可能在任何其他点添加它们。

The real oddity of NetBeans 12 is that it works perfectly even with old projects made with NetBeans 8 and JDK6. NetBeans 12 的真正奇怪之处在于,即使是使用 NetBeans 8 和 JDK6 制作的旧项目,它也能完美运行。 but reinstalling previous NetBeans 10 still remaisn a trouble.但是重新安装以前的 NetBeans 10 仍然很麻烦。 I'm stuck making new projects that need libraries: Minor problems are: System.err.println doesn't write in red colour, the path src/mycode has become src/main/java/mycode , why?我一直在制作需要库的新项目: 小问题是: System.err.println没有写成红色,路径src/mycode已变为src/main/java/mycode ,为什么? and perhaps many others.也许还有许多其他人。 My attempts are over.我的尝试结束了。 I've installed我已经安装

  • OS: Window 10操作系统:Window 10
  • jdk-14_window-x64_bin.exe jdk-14_window-x64_bin.exe
  • Apache NetBeans 12 LTS Apache NetBeans 12 LTS
  • Binaries: netbeans-12.0-bin.zip (SHA-512, PGP ASC) 1st try二进制文件:netbeans-12.0-bin.zip(SHA-512,PGP ASC)第一次尝试
  • Installers: Apache-NetBeans-12.0-bin-windows-x64.exe (SHA-512, PGP ASC) 2nd try.安装程序:Apache-NetBeans-12.0-bin-windows-x64.exe(SHA-512,PGP ASC)第二次尝试。

It's a Java project using Maven这是一个使用 Maven 的 Java 项目

I don't know Gradle and Ant (what are they for?)我不知道 Gradle 和 Ant(它们是干什么用的?)

  • Project Properties (MYPROG)-->Build has only Compile without Compiling, Packaging, Deployment, Documenting项目属性(MYPROG)-->构建只有编译,没有编译、打包、部署、记录
  • Project Properties (MYPROG)--> Libraries does not exist instead: JavaScript libraries (empty)项目属性 (MYPROG)--> 库不存在,而是:JavaScript 库(空)

When you are using Maven, the Project properties do not have a Libraries section, because the libraries are managed through Maven (and not NetBeans).当您使用 Maven 时,项目属性没有库部分,因为库是通过 Maven(而不是 NetBeans)管理的。

You manage the needed libraries through the "Dependencies" node of the project or by editing pom.xml directly:您可以通过项目的“依赖项”节点或直接编辑pom.xml来管理所需的库:

在此处输入图像描述

But this has been the case since NetBeans started supporting Maven (so probably 8.0 or something along those lines).但自从 NetBeans 开始支持 Maven (所以可能是 8.0 或类似的东西)以来,情况就一直如此。 If you had a "Libraries" section in the project properties before, you were using an Ant based project.如果您之前在项目属性中有“库”部分,则您使用的是基于 Ant 的项目。

path src/mycode has become src/main/java/mycode , why?路径src/mycode变成了src/main/java/mycode ,为什么?

Because src/main/java is the default directory layout Maven uses.因为src/main/java是 Maven 使用的默认目录布局。

If you recreate the project as Ant project, you will have the option to import library in the project properties.如果您将项目重新创建为 Ant 项目,您将可以选择在项目属性中导入库。

Netbeans Java project with Ant Netbeans Java 项目与 Ant

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM