简体   繁体   English

有没有办法阻止NetBeans扫描项目?

[英]Is there a way to stop NetBeans scanning projects?

I don't have much memory on my PC and a pretty weak processor. 我的电脑没有太多内存和处理器非常弱。 Although netbeans is by far my favorite IDE it is almost unbearable to use on my present computer because of the project scanning that starts automatically when I open the program. 虽然netbeans是迄今为止我最喜欢的IDE,但由于项目扫描在我打开程序时会自动启动,因此在我现有的计算机上使用它几乎是无法忍受的。

Is there a way to prevent netbeans from scanning projects? 有没有办法阻止netbeans扫描项目?

Hey George I don't know if this is much of an answer but I right-click and choose 'close' on the projects that I don't need open. 嘿乔治我不知道这是否是一个答案,但我右键单击并选择“关闭”我不需要打开的项目。 There's no point in having all your past projects listed there. 将所有过去的项目都列在那里是没有意义的。 Just have the one that you are developing open. 只要你正在开发的那个。 You can always reopen the other projects from the menu. 您始终可以从菜单中重新打开其他项目。 Once all the projects you aren't using are closed they won't be scanned each time you start Netbeans. 一旦您使用的所有项目都关闭,每次启动Netbeans时都不会扫描它们。

In addition to creating smaller Projects for the folders you really work on and then a Project Group to group them (Mateng), you can try excluding folders that you will never work on such as images folders and so on. 除了为您真正使用的文件夹创建较小的项目 ,然后为项目组创建它们(Mateng),您可以尝试排除您将永远不会使用的文件夹,如images文件夹等。 To ignore those folders, go to: 要忽略这些文件夹,请转到:

File > Project Properties > Ignored Folders > Add Folder...

From NetBeans Help: 从NetBeans帮助:

The Ignored Files property is the opposite of the Include Path. “忽略的文件”属性与“包含路径”相反。 These are files inside the PHP project that you want the IDE to ignore for FTP upload, scanning , etc. 这些是PHP项目中的文件,您希望IDE在FTP上载, 扫描等时忽略这些文件。

Try this: http://wiki.netbeans.org/ScanOnDemand 试试这个: http//wiki.netbeans.org/ScanOnDemand

Warning: Currently, this plugin only works with development builds. 警告:目前,此插件仅适用于开发版本。 DO NOT use these instructions with an official release... 请勿在官方发布中使用这些说明......

As soon as you start the NetBeans IDE, the system does so called "up-to-date check" to verify that no files have been changed. 一旦启动NetBeans IDE,系统就会执行所谓的“最新检查”以验证是否未更改任何文件。 If this seems to take too long in your case, and prevents you from performing your work, you may be interested in ScanOnDemand . 如果这种情况在你的情况下似乎花了太长时间,并阻止你执行你的工作,你可能会对ScanOnDemand感兴趣。

The most basic functionality of ScanOnDemand is to disable (potentially long) up-to-date check after start of the IDE. ScanOnDemand的最基本功能是在启动IDE后禁用(可能很长)最新检查。 This is done under the expectation that most of the operations with your sources are done from inside the IDE and thus when the IDE is shut down, no important change can happen and thus there is no need to rescan anything. 这是在期望您的源的大多数操作都是在IDE内部完成的情况下完成的,因此当IDE关闭时,不会发生重大更改,因此无需重新扫描任何内容。 Indeed, this may not be fully accurate, but the fix is easy, in the rare situation where your significantly updated your sources using other tools, just trigger the refresh manually. 实际上,这可能不完全准确,但修复很容易,在极少数情况下,使用其他工具显着更新您的源,只需手动触发刷新。

Once again the NetBeans IDE gives you more control. NetBeans IDE再一次为您提供了更多控制权。 You stay in charge, deciding what to do and when... 你保持负责,决定做什么,什么时候......

To help in this area, we decided to create an experimental module, which is available on Update Center (as of release 6.7). 为了在这方面提供帮助,我们决定创建一个实验模块,该模块可在更新中心上获得(截至6.7版)。 The module omits automatic updates in certain situations (eg up-to-date check after startup and after switch to main window). 该模块在某些情况下省略了自动更新(例如,启动后和切换到主窗口后的最新检查)。 The responsibility to invoke rescan and so make the data up-to-date is on the user - via explicit refresh action... 调用重新扫描并使数据保持最新的责任在于用户 - 通过显式刷新操作...

i know this is an old question but this may help others... To enable or disable background scanning you can find the option under menu Tools -> Options -> Miscellaneus -> Files 我知道这是一个老问题,但这可能有助于其他人...要启用或禁用后台扫描,您可以在菜单工具 - >选项 - >错误 - >文件下找到该选项

https://blogs.oracle.com/netbeansphp/entry/enable_auto_scanning_of_sources https://blogs.oracle.com/netbeansphp/entry/enable_auto_scanning_of_sources

Stop NetBeans scanning projects : 停止NetBeans扫描项目:

   Menu -> Tools -> Options -> Miscellaneus -> Files -> Uncheck Enabel auto-scanning

停止Netbeans扫描项目

In addition to close unneeded projects (David) you can create project groups containing related projects (or just one): 除了关闭不需要的项目 (David),您还可以创建包含相关项目(或只有一个)的项目组:

File > Project Group > New Group... . File > Project Group > New Group...

Project groups can then be opened by pointing at them from the same menu. 然后可以通过从同一菜单中指向项目组来打开项目组。 Best of all: Each group remembers which files were open in the editor windows the last time. 最重要的是:每个组都会记住最后一次在编辑器窗口中打开的文件。 I organize all my projects into groups and it reduces scanning significantly. 我将所有项目组织成组,这大大减少了扫描。

(btw: There's a handy plugin providing a project group shortcut to the toolbar ) (顺便说一句:有一个方便的插件提供工具栏项目组快捷方式

Edit: I am also using Scan on Demand for a while now - really good. 编辑:我现在也在使用Scan on Demand一段时间 - 非常好。 Kudos for that answer. 感谢那个答案。

I don't know whether you can disable the project scanning or not. 我不知道你是否可以禁用项目扫描。 Even if you can, I doubt it will ever work properly again. 即使你可以,我怀疑它会再次正常工作。 There are a few tips which I have done and it speed up my Netbeans. 我做了一些提示,它加快了我的Netbeans。

  1. Close Tasks window. 关闭任务窗口。 This prevents Netbeans to scan for TODO in the comments. 这可以防止Netbeans在评论中扫描TODO。
  2. Exclude virus scanning for *.jar, java folders and netbeans folder. 排除* .jar,java文件夹和netbeans文件夹的病毒扫描。 This speeds up my netbeans A LOT. 这加快了我的netbeans A LOT。

Netbeans consumes a lot of memory so adding memory also increases its performance (OS does not need to swap between memory and page file when memory is running low) (but this is probably not an option for you). Netbeans消耗大量内存,因此添加内存也会提高其性能(当内存不足时,操作系统不需要在内存和页面文件之间进行交换)(但这可能不是您的选择)。 Also, Netbeans consists of hundreds of files which needs to be loaded at start up so the bottom neck is the speed of your hard disk. 此外,Netbeans包含数百个需要在启动时加载的文件,因此底部是硬盘的速度。

For Netbeans 8.*+ , the ScanOnDemand plugin from Zeophlite's answer does not work. 对于Netbeans 8。* +Zeophlite的答案中的ScanOnDemand插件不起作用。 Use MasterFileSystemSuspend instead, as it is current and works fine on stable releases. 请改用MasterFileSystemSuspend ,因为它是最新的并且在稳定版本上运行良好。

Plugin to control when the NetBeans IDE reacts to changes and when it ignores them. 用于控制NetBeans IDE何时对更改做出反应以及何时忽略更改的插件。 Useful addition to compile on save with additional user actions - by putting the IDE into suspended mode, one can perform (and finish) command line operations and only then turn the IDE on. 使用其他用户操作进行保存时编译的有用补充 - 通过将IDE置于挂起模式,可以执行(并完成)命令行操作,然后再打开IDE。

The code for the plugin is in main/contrib repository. 插件的代码在main / contrib存储库中。 The plugin can be downloaded from media:Org-netbeans-modules-masterfs-suspend.nbm‎ and installed (Tools/Plugins/Downloaded) into NetBeans 8.0, 8.1, 8.2 . 该插件可以从下载媒体:ORG-netbeans的模块-masterfs-suspend.nbm和安装(工具/插件/下载)到的NetBeans 8.0,8.1,8.2。

在此输入图像描述

After installation a new icon appears in the toolbar which one can click to suspend the automatic refresh done by the IDE. 安装后,工具栏中会出现一个新图标,可以单击该图标以暂停IDE完成的自动刷新。 Very useful when working with Truffle sources in NetBeans 8.2 and newer. 在NetBeans 8.2及更高版本中使用Truffle源时非常有用。

This module is a handy replacement of previous ScanOnDemand module. 该模块是以前ScanOnDemand模块的便捷替代品。


On a personal note, this brought my netbeans memory consumption for general use down from 20gb+ during idle to about 2gb consistently, and provides a good workaround for the scanner constantly hanging and leaking memory, particularly in very large projects or those with a ton of symlinks. 从个人角度来说,这使我的netbeans内存消耗量从闲置时的20gb +一直降至约2gb,并为扫描仪不断挂起和泄漏内存提供了良好的解决方法,特别是在非常大的项目或有大量符号链接的项目中。

And another quick thing you can do just delete the nbproject folder inside your project then open the NeteBeans. 另外你可以做的另一件事就是删除项目中的nbproject文件夹,然后打开NeteBeans。 then the project remove from the list. 然后项目从列表中删除。 this I do some times when it got freeze 这有点我冻结的时候

I've stumbled upon this problem aswell. 我偶然发现了这个问题。

The most simple thing is to edit the netbeans config so it doesn't load all your projects. 最简单的事情是编辑netbeans配置,这样它就不会加载你的所有项目。 you can always reopen the other projects from the menu. 您可以随时从菜单中重新打开其他项目。 once all the projects you arent using are closed they wont be scanned each time you start netbeans 一旦您使用的所有项目都关闭,每次启动netbeans时都不会扫描它们

Solution: Just change the following line in netbeans.conf found under etc folder 解决方案:只需更改etc文件夹下的netbeans.conf中的以下行

# ${HOME} will be replaced by JVM user.home system property netbeans_default_userdir="${HOME}/.netbeans/changeme" #$ {HOME}将替换为JVM user.home系统属性netbeans_default_userdir =“$ {HOME} /.netbeans / changeme”

I also face the same problem with netbean 8.2. 我也遇到了与netbean 8.2相同的问题。 I just deleted the project by - Right click on the project - Delete the project ( keep unselect delete source code option ). 我刚刚删除了项目 - 右键单击​​项目 - 删除项目(保持取消选择删除源代码选项)。 - Again create new project - 再次创建新项目

and its working perfectly now. 现在它完美地工作了。

Hope its work. 希望它的工作。

Try this Netbeans plugin. 试试这个Netbeans插件。 This reduces the load for some extend. 这在一定程度上减少了负载。

http://wiki.netbeans.org/ScanOnDemand http://wiki.netbeans.org/ScanOnDemand

不完全是问题,但有时可以通过重新启动Netbeans来停止“扫描项目”。

In my case, with jdk 1.8, there is a big issue when there are multiple static imports (see the example). 就我而言,使用jdk 1.8时,存在多个静态导入时会出现一个大问题(参见示例)。 It seems that there is a problem with javac. 似乎javac存在问题。 The compiler is very slow when checking such a .java file and NetBeans scanning is very very slow. 检查这样的.java文件时编译器非常慢,NetBeans扫描非常慢。 It seems that the compilation and scanning time is increasing very fast with each repeated static import. 似乎每次重复的静态导入,编译和扫描时间都在快速增加。 So, if that is your case, just remove repeated imports 因此,如果是这种情况,只需删除重复的导入

package ru.cntp.demo;

import java.math.BigDecimal;

import static java.util.Arrays.asList;
import java.util.List;
import java.util.Map;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.groupingBy;

/**
 *
 * @author sergiu
 */
public class EmployeeRepository {

    public Map<Department, Map<String, Map<String, Map<String, Map<BigDecimal, List<Employee>>>>>> getEmployeesByDepartment() {

        Country germany = new Country("Germany");

        Department germanyDeptOne = new Department("Dept One", germany);

        Employee emp1 = new Employee("Surame", "Name", "Patronymic", BigDecimal.TEN, germanyDeptOne);


        return asList(emp1).stream()
                .collect(groupingBy(Employee::getDepartment,
                        groupingBy(Employee::getSurname,
                                groupingBy(Employee::getName,
                                        groupingBy(Employee::getPatronymic,
                                                groupingBy(Employee::getSalary))))));
    }

}

Scanning performance of Netbeans can be improved using the following procedure : 使用以下过程可以提高Netbeans的扫描性能:
1) Go to Window-->Files. 1)转到窗口 - >文件。 This opens the Files Tab. 这将打开“文件”选项卡。
2) In the Files Tab for each opened project open the nbproject folder and inside it open the project.properties file. 2)在每个打开的项目的Files选项卡中打开nbproject文件夹,在其中打开project.properties文件。
3) Now in this file below the property "excludes" there are file references listed for all your referred Libraries (JARs) 3)现在在这个文件下面的属性“排除”,列出了所有引用的库(JAR)的文件引用
4) There might be some repeated file references with paths that may be old or on someone else's machine(if you are working in a group and transferred projects from someone's machine) 4)可能存在一些重复的文件引用,其路径可能是旧的或在其他人的机器上(如果您在一个组中工作并从某人的机器传输项目)
5) Delete those old path references. 5)删除那些旧的路径引用。
Example - 示例 -
excludes=
file.reference.xyz.jar=../not/correct/path.jar //delete this line
file.reference.xyz.jar-1=../correct/path.jar //remove -1
....
includes=**

6)Also locate the property "javac.classpath" and delete the unnecessary classpath entries corresponding to the deleted references as described above. 6)还要找到属性“javac.classpath”并删除与删除的引用相对应的不必要的类路径条目,如上所述。
Example - 示例 -
javac.classpath=\\
${file.reference.xyz.jar}:\\ //delete this line
${file.reference.xyz.jar-1}:\\ //remove -1
....
javac.compilerargs=

7) So now the file reference mentioned in the file reference section and the javac.classpath property is same and points to a valid Library (JAR) address on your machine or network. 7)所以现在文件引用部分中提到的文件引用和javac.classpath属性是相同的,并且指向计算机或网络上的有效库(JAR)地址。
Example - 示例 -
excludes=
file.reference.xyz.jar=../correct/path.jar //the correct reference & path
....
includes=**
....
javac.classpath=\\
${file.reference.xyz.jar}:\\ //the correct classpath entry for reference
....
javac.compilerargs=
....

The reason the above procedure worked (in my case) is because it prevents Netbeans from scanning unnecessary Library paths that may not be present on your machine/network. 上述过程工作的原因(在我的情况下)是因为它阻止了Netbeans扫描机器/网络上可能不存在的不必要的库路径。

I have the quickest and easiest way. 我有最快捷,最简单的方法。

Just put the netbeans metadata to another location instead of putting it on the project directory 只需将netbeans元数据放到另一个位置,而不是将其放在项目目录中

If your project is a Maven structured project you can use a simple trick to make your and NetBeans life a lot easier. 如果您的项目是Maven结构化项目,您可以使用一个简单的技巧,使您的NetBeans生活更轻松。

I have my projects inside of c:\\dev on my machine. 我在我的机器上的c:\\ dev里面有我的项目。 That's the place where Netbeans is working with. 那是Netbeans合作的地方。 If I build in this folder then NetBean's background process get very busy. 如果我在这个文件夹中构建,那么NetBean的后台进程会非常繁忙。

But if I copy the c:\\dev\\trunk project for example to c:\\deploy\\trunk before I start mvn clean install inside of c:\\build\\trunk then NetBeans does not need to scan the changes that happen in this folder. 但是,如果我在c:\\ build \\ trunk中启动mvn clean install之前将c:\\ dev \\ trunk项目复制到c:\\ deploy \\ trunk ,则NetBeans不需要扫描此文件夹中发生的更改。 It does not know about it. 它不知道它。

I use on a windows machine: 我在Windows机器上使用:

robocopy c:\\dev\\trunk c:\\deploy\\trunk /MIR /NFL /NS /NC /NDL /XD ".svn" robocopy c:\\ dev \\ trunk c:\\ deploy \\ trunk / MIR / NFL / NS / NC / NDL / XD“.svn”

It is a windows native command. 这是一个Windows本机命令。 No additional installation necessary. 无需额外安装。

It helped me a lot decrease build time and also to avoid never ending scans on Netbeans. 它帮助我减少了大量的构建时间,也避免了Netbeans上永无止境的扫描。

If you use tools like JRebel you can still work like this when you update the changed classes to your c:\\deploy\\trunk folder. 如果您使用像JRebel这样的工具,当您将更改的类更新到c:\\ deploy \\ trunk文件夹时,仍然可以这样工作。 You can use the same command. 您可以使用相同的命令。

It is of course a bit of a workaround, but it helps a lot. 这当然是一种解决方法,但它有很多帮助。 :-) :-)

My project became Very Big over time 我的项目随着时间的推移变得非常大

In the below 2 cases, it is too slow: 在以下2个案例中,它太慢了:

  1. While opening NetBeans project - this is too slow 在打开NetBeans项目时 - 这太慢了
  2. Automatic scanning of NetBeans project 自动扫描NetBeans项目

What did not work for me are: 对我不起作用的是:
1. Doing Window > Reset Windows only solves temporarily 1.执行窗口>重置Windows仅暂时解决
2. Sometimes felt my GIT repository integration with Netbeans is the main issue, but there was no clear proof for it 2.有时觉得我的GIT存储库与Netbeans的集成是主要问题,但没有明确的证据

Solution for 1): 解决方案1):

Run below commands: 运行以下命令:

WARNING Below commands have automated delete commands 警告下面的命令具有自动删除命令

Close the Netbeans IDE
cd %USERPROFILE%\AppData\Local\NetBeans\Cache\                  && del /s /q .\  && rmdir /s /q .\
cd %USERPROFILE%\AppData\Roaming\NetBeans\8.2\var\filehistory\  && del /s /q .\  && rmdir /s /q .\
cd %USERPROFILE%\AppData\Roaming\NetBeans\8.2\var\log           && del /s /q .\  && rmdir /s /q .\

And, the problem 1) is now rarely comes up, other times Netbeans loads almost immediately. 而且,问题1)现在很少出现,其他时候Netbeans几乎立即加载。

Solution for 2): 解决方案2):

root
....f1 F1 ....
........f11 ........ F11
........f12 ........ F12
....f2 F2 ....
........f21 ........ F21
........f22 ........ F22

root is a folder and also it's the main NetBeans project root是一个文件夹,也是主要的NetBeans项目
f1, f2 are just folders f1,f2只是文件夹
f11, f12, f21, f22 are sub-folders that are also NetBeans projects too f11,f12,f21,f22也是NetBeans项目的子文件夹

Earlier, I was opening root Netbeans project, and the system became too slow due to netbeans scanning the whole project from root, and antivirus was working very hard to cooperate with Netbeans project scanning, result everything in system gets slow. 早些时候,我正在打开root Netbeans项目,由于netbeans从root用户扫描整个项目,系统变得太慢,而且杀毒软件很难配合Netbeans项目扫描,导致系统中的一切都变慢。

Now, the solution is open sub-projects like f11, f12, f21, f22, etc. you can open many small sub-project, the Netbeans project scanning issue is fully gone. 现在,解决方案是开放子项目,如f11,f12,f21,f22等,你可以打开很多小子项目,Netbeans项目扫描问题完全消失了。

My Netbeans 8.0.2 would crash on my Macbook pro due to "Scanning projects..." hogging up my CPU. 由于“扫描项目......”占用我的CPU,我的Netbeans 8.0.2会因我的Macbook pro而崩溃。 I couldn't stop the process, however, I could make the process finish quicker by increasing the Java heap memory in netbeans.conf. 我无法阻止这个过程,但是,我可以通过增加netbeans.conf中的Java堆内存来加快进程。

$ vi /Applications/NetBeans/NetBeans\ 8.0.2.app/Contents/Resources/NetBeans/etc/netbeans.conf

Replace this: 替换这个:

netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true -J-Dsun.zip.disableMemoryMapping=true"

with: 有:

netbeans_default_options="-J-client -J-Xss2m -J-Xms2048m -J-Xmx2048m -J-XX:PermSize=32m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true -J-Dsun.zip.disableMemoryMapping=true"

This below solved it for me. 下面这个解决了我。 One project when opened would cause never ending background scanning... this would also mean the code completion etc could never work. 打开一个项目会导致永无止境的后台扫描...这也意味着代码完成等永远不会起作用。 My machine was devoting a huge amount of resources to this. 我的机器为此投入了大量资源。

Someone here gave me the clue: right click the project, choose properties, then "Ignored Folders". 这里有人给我线索:右键单击项目,选择属性,然后选择“忽略的文件夹”。

Essentially I used this to determine which (specific) folder was the cause of the scanning. 基本上我用它来确定哪个(特定)文件夹是扫描的原因。 I selected the first half, then the second half of the remaining etc a process of elimination... and out of hundreds of folders, I found a (php HMVC view folder that caused it) ... I needed to stop and kill the scanning, then re-start many times... 我选择了上半部分,然后是剩下的后半部分等一个消除过程......在数百个文件夹中,我发现了一个(php HMVC视图文件夹导致它)...我需要停止并杀死扫描,然后重新开始多次......

Here is the easiest way for various reasons: 出于各种原因,这是最简单的方法:

In the "ignore folders" area, select all the folders and add them all (fairly individually) to the ignore list. 在“忽略文件夹”区域中,选择所有文件夹并将它们(相当单独地)添加到忽略列表中。 Then shut down the ide, and restart. 然后关闭ide,然后重新启动。 When all background scanning is absent (it starts and runs for a few seconds/minutes normally), begin removing one or a few of the folders. 如果没有所有后台扫描(它正常启动并运行几秒钟/几分钟),则开始删除一个或几个文件夹。 After each removal, close the properties window..... the IDE will quickly scan those folders you removed and will IF no issue with those stop scanning. 每次删除后,关闭属性窗口...... IDE将快速扫描您删除的文件夹,如果没有停止扫描问题。 IF you have just removed the culprit folder, then the scanning will never end... 如果您刚刚删除了罪魁祸首文件夹,那么扫描将永远不会结束......

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

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