Eclipse hangs on "verifying launch attributes" in large Maven projects
From the chat:
mvn test spends ~ 20 seconds downloading maven-metadata.xml for our own packages from our own snapshot repository - something I don't see Eclipse doing. There is no large delay before mvn test starts showing output.
Closing all projects except the one you need brings build time down to 5s the POM is configured to check every build for changes in snapshot, so the download happens every time
The m2e plugin of Eclipse uses the same strategies as Maven. If you tell Maven to check snapshots for every build, then Eclipse will also do this. If mvn test
spends 20s checking dependencies, Eclipse will need the same time (you should be able to see this in the Maven Console in Eclipse; you can find this console in the same dropdown menu as the Stack Trace Console - look for the button with the little +
in the upper right corner in the Console View)
Suggestions to reduce build times:
- Change the config of the POMs to check snapshots only once per day. Use
mvn -U
to upgrade them during the day. I think this change will bring the biggest gains. - Use a CI server to build 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 snapshot dependencies if they aren't part of the current build.
- upgrade your network and try to tune your Maven proxy server (where you download the snapshots from). My experience is that this step is expensive and doesn't give that much gain.
- close as many projects as you can. This generally makes Eclipse faster but doesn't help with snapshot checks, obviously.
- Avoid snapshots; work more with released builds. Come up with a fast release process so you can do many releases per day if the need arises.
[EDIT] Reading an XML file doesn't take 2 seconds unless you have not enough memory. Please check this (use "General / Heap status" in the preferences).
If it's still slow, then m2e does something in this "Read Maven project" step. My guess is that it recalculates the classpath. If this takes long, then either:
- something is broken in your setup (-> new workspace should fix this)
- your local Maven repository is somehow corrupt. Try to delete
$HOME/.m2/repository/
- If you have "always update" enable, disable this. If it's now fast, then your network or the company Maven repo is slow. You will either have to disable the "always update" again, live with the slowness or talk to your admins.
- Try to disable all plugins that you don't need. You may have to install a second Eclipse for this. Maybe one of the other plugins causes the delays. I've seen this with the eGit plugin which would sometimes go into an infinite loop trying to refresh the workspace state.
- Windows: Do not create your workspace in your user's home folder or any folder which Windows indexes.
If closing projects helps, then you may have to close as many projects as you can.
So far, the only thing that helps is closing a lot of projects in my workspace. When I have 30 Maven dependencies coming from my worksapce, the unit test take 30+ seconds to start. When I close those projects and forse Eclipse to go to local repository, the start of unit tests takes 5 seconds.
I see no correlation between start time and "external" dependencies. Only "internal" (in workspace and open) dependencies matter.