Eclipse hangs over “run attribute validation” in large Maven projects

I use Eclipse to develop a large Maven project (dozens of dependencies). When I try to run the unit test, I see a pause for about a minute, while the status displays a "run attribute check". Watching the Eclipse actions in Process Monitor, I see many access files to various locks and banks in the Maven repository. It looks like Eclipse is scrolling through every JAR that my project depends on. Once this file access is complete, the actual testing will begin.

I know the tips offered in “ Why does Eclipse hang at 57% with the status“ Checking launch attributes ... ”when starting the launch configuration? ” And I followed the suggested fixes. I think Eclipse does what it should do, going through each JAR. My question is: how can I disable this behavior in either Eclipse or Maven?

I am using Eclipse Luna on Windows 7, m2e version 1.5.0.20140606

Edit:

Below is a sample of what I see in Process Monitor:

In short, we spent about 10 seconds on sensible activity, such as checking the status of Java and JAR files, and then we spent ~ 40 seconds locking Maven repo and reading POM files.

Why does an eclipse do this? And what do I need to change to stop it?

11:31:48.1468054 AM eclipse.exe 3736 CreateFile C:\LAS\Maven\Repository\org\drools\drools-core\6.0.1.Final\drools-core-6.0.1.Final.jar SUCCESS Desired Access: Read Attributes, Synchronize, Disposition: Open, Options: Synchronous IO Non-Alert, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened 11:31:48.1469017 AM eclipse.exe 3736 QueryBasicInformationFile C:\LAS\Maven\Repository\org\drools\drools-core\6.0.1.Final\drools-core-6.0.1.Final.jar SUCCESS CreationTime: 7/21/2014 11:13:15 AM, LastAccessTime: 7/21/2014 11:13:15 AM, LastWriteTime: 7/21/2014 11:13:22 AM, ChangeTime: 7/21/2014 11:13:23 AM, FileAttributes: A 11:31:48.1469769 AM eclipse.exe 3736 CloseFile C:\LAS\Maven\Repository\org\drools\drools-core\6.0.1.Final\drools-core-6.0.1.Final.jar SUCCESS 11:31:50.0040011 AM eclipse.exe 3736 CreateFile C:\LAS\Maven\Repository\xpp3\xpp3_min\1.1.4c\xpp3_min-1.1.4c.jar SUCCESS Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened 11:31:50.0040832 AM eclipse.exe 3736 QueryNetworkOpenInformationFile C:\LAS\Maven\Repository\xpp3\xpp3_min\1.1.4c\xpp3_min-1.1.4c.jar SUCCESS CreationTime: 7/21/2014 11:13:15 AM, LastAccessTime: 7/21/2014 11:13:15 AM, LastWriteTime: 7/21/2014 11:13:21 AM, ChangeTime: 7/21/2014 11:13:23 AM, AllocationSize: 28672, EndOfFile: 24956, FileAttributes: A 11:31:50.0041397 AM eclipse.exe 3736 CloseFile C:\LAS\Maven\Repository\xpp3\xpp3_min\1.1.4c\xpp3_min-1.1.4c.jar SUCCESS 

(for four seconds)

 11:31:50.0700821 AM eclipse.exe 3736 CreateFile C:\LAS\Maven\Repository\.locks\com.lmax~disruptor~3.3.0.aetherlock SUCCESS Desired Access: Write Attributes, Synchronize, Disposition: Open, Options: Synchronous IO Non-Alert, Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened 11:31:50.0701770 AM eclipse.exe 3736 SetBasicInformationFile C:\LAS\Maven\Repository\.locks\com.lmax~disruptor~3.3.0.aetherlock SUCCESS CreationTime: 0, LastAccessTime: 0, LastWriteTime: 0, ChangeTime: 0, FileAttributes: N 11:31:50.0703100 AM eclipse.exe 3736 CloseFile C:\LAS\Maven\Repository\.locks\com.lmax~disruptor~3.3.0.aetherlock SUCCESS 11:31:59.7990517 AM eclipse.exe 3736 CreateFile C:\LAS\Maven\Repository\.locks\xpp3~xpp3_min~1.1.4c.aetherlock SUCCESS Desired Access: Read Attributes, Delete, Disposition: Open, Options: Non-Directory File, Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened 11:31:59.7991381 AM eclipse.exe 3736 QueryAttributeTagFile C:\LAS\Maven\Repository\.locks\xpp3~xpp3_min~1.1.4c.aetherlock SUCCESS Attributes: N, ReparseTag: 0x0 11:31:59.7991864 AM eclipse.exe 3736 SetDispositionInformationFile C:\LAS\Maven\Repository\.locks\xpp3~xpp3_min~1.1.4c.aetherlock SUCCESS Delete: True 11:31:59.7992609 AM eclipse.exe 3736 CloseFile C:\LAS\Maven\Repository\.locks\xpp3~xpp3_min~1.1.4c.aetherlock SUCCESS 

(value 9 seconds)

 11:31:59.8364794 AM eclipse.exe 3736 CreateFile C:\LAS\Maven\Repository\com\lmax\disruptor\3.3.0\disruptor-3.3.0-sources.jar SUCCESS Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened 11:31:59.8367613 AM eclipse.exe 3736 QueryNetworkOpenInformationFile C:\LAS\Maven\Repository\com\lmax\disruptor\3.3.0\disruptor-3.3.0-sources.jar SUCCESS CreationTime: 11/18/2014 2:17:33 PM, LastAccessTime: 11/18/2014 2:17:33 PM, LastWriteTime: 11/18/2014 2:17:33 PM, ChangeTime: 11/18/2014 2:17:33 PM, AllocationSize: 81920, EndOfFile: 80291, FileAttributes: A 11:31:59.8367994 AM eclipse.exe 3736 CloseFile C:\LAS\Maven\Repository\com\lmax\disruptor\3.3.0\disruptor-3.3.0-sources.jar SUCCESS 11:32:02.0222874 AM eclipse.exe 3736 CreateFile C:\LAS\Maven\Repository\org\antlr\antlr-runtime\3.5\antlr-runtime-3.5.jar SUCCESS Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened 11:32:02.0223541 AM eclipse.exe 3736 QueryNetworkOpenInformationFile C:\LAS\Maven\Repository\org\antlr\antlr-runtime\3.5\antlr-runtime-3.5.jar SUCCESS CreationTime: 7/21/2014 11:13:15 AM, LastAccessTime: 7/21/2014 11:13:15 AM, LastWriteTime: 7/21/2014 11:13:21 AM, ChangeTime: 7/21/2014 11:13:22 AM, AllocationSize: 167936, EndOfFile: 167735, FileAttributes: A 11:32:02.0223896 AM eclipse.exe 3736 CloseFile C:\LAS\Maven\Repository\org\antlr\antlr-runtime\3.5\antlr-runtime-3.5.jar SUCCESS 

(3 seconds worth)

 11:32:33.2963547 AM eclipse.exe 3736 CreateFile C:\LAS\Maven\Repository\.locks\commons-logging~commons-logging~1.1.aetherlock SUCCESS Desired Access: Read Attributes, Delete, Disposition: Open, Options: Non-Directory File, Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened 11:32:33.2964727 AM eclipse.exe 3736 QueryAttributeTagFile C:\LAS\Maven\Repository\.locks\commons-logging~commons-logging~1.1.aetherlock SUCCESS Attributes: N, ReparseTag: 0x0 11:32:33.2965390 AM eclipse.exe 3736 SetDispositionInformationFile C:\LAS\Maven\Repository\.locks\commons-logging~commons-logging~1.1.aetherlock SUCCESS Delete: True 11:32:33.2966382 AM eclipse.exe 3736 CloseFile C:\LAS\Maven\Repository\.locks\commons-logging~commons-logging~1.1.aetherlock SUCCESS 11:32:33.2970685 AM eclipse.exe 3736 CreateFile C:\LAS\Maven\Repository\commons-logging\commons-logging\1.1\commons-logging-1.1.pom SUCCESS Desired Access: Synchronize, Disposition: Open, Options: , Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened 11:32:33.2971806 AM eclipse.exe 3736 QueryNameInformationFile C:\LAS\Maven\Repository\commons-logging\commons-logging\1.1\commons-logging-1.1.pom SUCCESS Name: \LAS\Maven\Repository\commons-logging\commons-logging\1.1\commons-logging-1.1.pom 11:32:33.2972430 AM eclipse.exe 3736 CloseFile C:\LAS\Maven\Repository\commons-logging\commons-logging\1.1\commons-logging-1.1.pom SUCCESS 11:32:33.2980275 AM eclipse.exe 3736 CreateFile C:\LAS\Maven\Repository\commons-logging\commons-logging\1.1\commons-logging-1.1.pom SUCCESS Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a, OpenResult: Opened 11:32:33.2981528 AM eclipse.exe 3736 ReadFile C:\LAS\Maven\Repository\commons-logging\commons-logging\1.1\commons-logging-1.1.pom SUCCESS Offset: 0, Length: 4,096, Priority: Normal 11:32:33.2983145 AM eclipse.exe 3736 QueryStandardInformationFile C:\LAS\Maven\Repository\commons-logging\commons-logging\1.1\commons-logging-1.1.pom SUCCESS AllocationSize: 8,192, EndOfFile: 6,182, NumberOfLinks: 1, DeletePending: False, Directory: False 11:32:33.2983774 AM eclipse.exe 3736 ReadFile C:\LAS\Maven\Repository\commons-logging\commons-logging\1.1\commons-logging-1.1.pom SUCCESS Offset: 4,096, Length: 2,086 11:32:33.2984420 AM eclipse.exe 3736 QueryStandardInformationFile C:\LAS\Maven\Repository\commons-logging\commons-logging\1.1\commons-logging-1.1.pom SUCCESS AllocationSize: 8,192, EndOfFile: 6,182, NumberOfLinks: 1, DeletePending: False, Directory: False 11:32:33.2985057 AM eclipse.exe 3736 QueryStandardInformationFile C:\LAS\Maven\Repository\commons-logging\commons-logging\1.1\commons-logging-1.1.pom SUCCESS AllocationSize: 8,192, EndOfFile: 6,182, NumberOfLinks: 1, DeletePending: False, Directory: False 11:32:33.2987730 AM eclipse.exe 3736 CloseFile C:\LAS\Maven\Repository\commons-logging\commons-logging\1.1\commons-logging-1.1.pom SUCCESS 

(30 seconds!)

+5
source share
5 answers

So far, the only thing that helps is closing a large number of projects in my work area. When I have 30 Maven work dependencies coming from my workspace, it takes 30+ seconds to run the unit test. When I close these projects and force Eclipse to go to the local repository, it takes 5 seconds to run the unit tests.

I do not see a correlation between startup time and "external" dependencies. Only "internal" (in the workspace and open) dependencies matter.

+2
source

From chat:

mvn test takes ~ 20 seconds to download maven-metadata.xml for our own packages from our own snapshot repository - something I don't see in Eclipse. There is no big delay before mvn test starts showing output.
Closing all projects, except what you need, causes the build time to 5 seconds. POM is configured to check each build for snapshot changes, so the download happens every time

The m2e plugin for Eclipse uses the same strategies as Maven. If you tell Maven to check for snapshots for each build, then Eclipse will do it too. If mvn test takes 20 seconds to test dependencies, Eclipse will need the same time (you should see this in the Maven Console in Eclipse, you can find this console in the same drop-down menu as the Stack Trace Console - find the button with a small + in the upper right corner of the console window)

Suggestions for reducing assembly time:

  • Change the POM configuration to check snapshots only once a day. Use mvn -U to update them throughout the day. I think this change will bring the greatest benefits.
  • Use the CI server to create everything with the latest snapshots, so you don't have to waste time
  • Pull all snapshot dependencies into a single Maven project; Maven only downloads snapshots if they are not part of the current assembly.
  • upgrade your network and try setting up the Maven proxy (where you download the snapshots). My experience is that this step is expensive and does not give such a big gain.
  • close as many projects as you can. This usually makes Eclipse faster, but obviously does not help with snapshot checks.
  • Avoid snapshots; work more with released builds. Come up with a quick release process so that you can make many releases per day if the need arises.

[EDIT] Reading an XML file does not take 2 seconds if you do not have enough memory. Please check this (use "General / Heap" in the settings).

If it is still slow, then m2e does something at this point, "Read the Maven Project." I guess it recounts the path to the classes. If it takes a long time, then either:

  • something doesn't work in your setup (-> a new workspace should fix this)
  • Your local Maven repository is somehow corrupted. Try removing $HOME/.m2/repository/
  • If you have enabled "always update", disable it. If it's fast right now, then your network or Maven repo is slow. You will have to either turn off "always updating" again, or live with slowness, or talk with administrators.
  • Try disabling all plugins that you do not need. You may need to install a second Eclipse for this. Perhaps one of the other plugins is causing delays. I saw this with the eGit plugin, which sometimes went into an endless loop trying to update the state of the workspace.
  • Windows: Do not create a workspace in the user's home folder or in any folder in which Windows indexes.

If closing projects helps, you may need to close as many projects as you can.

+1
source

If possible, will you try using m2e 1.4.x with an older version of Eclipse? According to the answer received from the m2e developer on the m2e-user mailing list ( http://dev.eclipse.org/mhonarc/lists/m2e-users/msg05095.html ), a project cache size limit of m2e 1.5 was introduced. When we upgraded m2e from 1.4 to 1.6 (with the Eclipse version), we started to see issues like yours. I would like to see if you can recreate your problem with m2e 1.4.x. Thank you Tami

+1
source

I do not think that the cause of the problem is the excessive creation / access to the locks. I also have thousands of these log lines in my system and over 100 maven dependencies, but everything is quickly covered.
Try running tests outside of Eclipse. To do this, go to the .pom directory and enter

 mvn test 

If everything goes slowly again, then the eclipse is not the source of the problem, maybe these are bad sectors on the hard drive or who knows what.
However, if it's fast, then really Eclipse is a problem. You can try disabling validation globally by going to Settings> Validation, and then click Suspend All Validations and make sure your project does not override the global validation settings.

0
source

For this reason, I had one of the maven repositories, which caused m2e to freeze. I just disabled the host in my / etc / hosts and it worked.

0
source

Source: https://habr.com/ru/post/1210404/


All Articles