24

After recently converting to Maven from Ant, run configurations that launched immediately pre-Maven take an excessive amount of time and consume an abnormal amount of resources while Eclipse prepares to launch the projects.

Eclipse shows this status message:

Verifying launch attributes...

At 57% completion, Eclipse hangs for several minutes before finally launching the run configuration. Once launched, the project runs fine and without a problem.

I found this blog article that suggested to clean the local workspace, but that did not solve the problem, especially considering the author is using Git and I am not.

I am only using the latest m2e maven plugin, with the latest version of Eclipse.

What is causing Eclipse to block when launching these run configurations, and how can I fix it?

nickb
  • 59,313
  • 13
  • 108
  • 143
  • while none of the solutions helped me, i've found that restarting Eclipse sometimes makes the problem go away. i suspect that `m2e` gets confused sometimes. – Martin Serrano May 07 '15 at 13:27

8 Answers8

14

I had the same symptoms. I could fix it by adjusting

Eclipse -> Preferences -> Maven -> User Settings

My maven user settings file was stored on a remote folder. After moving the file to a local disk, the test now start instantly again.

joecracker
  • 509
  • 5
  • 7
  • In other words check your maven settings.xml and localRepository should point to your local drive/folder and then update above setting in our eclipse. – Chirag Apr 27 '14 at 15:25
  • This is a very good answer. A little change: Window > Preferences > Maven > User Settings > change path to file for User Settings – ROMANIA_engineer Aug 21 '14 at 11:02
2

This could be caused by duplicate / erroneous entries in the project's .classpath file. These entries are not necessary, as the maven plugin will take care of properly setting the classpath to launch your project.

To prevent Eclipse from hanging, open all of the referenced projects' .classpath files, which should be in the root directory of the project.

Remove all of the entries who have src as their kind attribute value.

For example:

<classpathentry kind="src" path="src"/>

Once all of these entries are removed, Eclipse will now launch your project instantly.

nickb
  • 59,313
  • 13
  • 108
  • 143
  • Is there a shell script I can run to do this automatically? I've got way too many projects to do this manually. – Matt Ball Oct 18 '14 at 03:56
  • when i tried this, i then received this error when trying to run tests: `The input type of the launch configuration does not exist`. – Martin Serrano May 07 '15 at 13:05
2

I know this is a rather old question, but I've been having this issue for a while now and none of the solutions found online seemed to work:

I did eventually found out (somehow) that having duplicate .classpath files in your workspace can cause serious issues. When importing a multi-module maven project you can easily do this by importing all your modules and your master module (the pom-type module). Doing so, you effectively import everything twice. Closing this master module in Eclipse solved the issue for me. Another workaround would be to not rely on m2eclipse and to use mvn eclipse:eclipse and then import your projects as an 'existing project'.

P_W999
  • 1,017
  • 12
  • 26
  • 1
    I'm right there with you, but AFAIK I don't have this multi-module issue because of the way I import Maven projects. `:'(` – Matt Ball Jan 08 '15 at 05:36
2

Unfortunately the progress information of the launching in Eclipse is not very accurate. The value of 57% is where all the hard work happens (see e.g. bug 354338).

If you are launching an Eclipse Application or JUnit Plug-in Tests, make sure you have the following plug-ins in your target platform:

  • org.junit
  • org.eclipse.jdt.junit.runtime
  • org.eclipse.jdt.junit4.runtime
  • org.eclipse.pde.junit.runtime

Otherwise Eclipse will search the whole p2 cache (in my case over 6000 plug-in jars, takes > 5min) for those plug-ins.

Community
  • 1
  • 1
ftl
  • 3,014
  • 1
  • 24
  • 25
  • how do you add these plugins – fanbondi Aug 17 '16 at 12:33
  • To access the target platform open the preferences (Window > Preferences) and navigate to Plug-in Development > Target Platform – ftl Aug 21 '16 at 11:57
  • Okay, then what options do you have to select. I think my problem is similar to yours. It will be good if you can provide the steps that one should take in eclipse to add all these plug-ins to the target platform. – fanbondi Aug 21 '16 at 13:47
1

I know this is a very old thread, but I just ran into it, and wanted to let anyone who sees this know how I resolved it; maybe it will help the next person. I switched to a new computer at work, and because I was lazy, I just copied my local Maven repository (%UserProfile%.m2) from the old computer to the new computer. After running into the "Launch Attributes" issue and trying everything else, I moved my local Maven repository to another location so that eclipse would be forced to rebuild the local Maven repository. This pretty much fixed the problem; while I sometimes have an occasional delay of 2-5 seconds when launching, it is a big improvement over the 30-90 seconds it was taking previously. Happy coding.

user3656711
  • 111
  • 2
0

I found this way to avoid 'verifying launch attributes... 57%' in Eclipse-Luna-SR2

  1. have the launch configuration and the main class in different projects
  2. delete the following line from the launch configuration:

    <stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
    
Frank Neblung
  • 3,047
  • 17
  • 34
  • This does solve the performance issue. It works for a basic test. But for a more complex test, it fails. The classpath seems to be different, and a different version of a lib is used, which of course causes issues. From what I read on the Internet, I didn't find a solution. However, I think it has been reported that in JetBrains the run of a JUnit test for a maven project launches instantly. I'm a bit sad that this kind of issue that upsets many devs daily is still unsolved. – Cristian Dec 06 '18 at 21:28
  • This is the right solution for me.In my case startup time decreased from about a minute to less than 3 seconds. – wypieprz Nov 29 '19 at 08:39
0

With eclipse 2018-12 I had a delay of about 10 seconds at "57%, verifying launch attributes" for every start of a main class or a junit test. I used the windows tool "procMon" to identify about 500.000 failed accesses to jars in this period that I don't have in my classpath. I found those jar references inside the Manifest "Class-Path" entry of many jars I use. After removing the Class-Path entry from all jars the delay now is only 1 second!

Some jars were signed. Then I had to remove the signature files (META-INF/*.SF|*.DSA|*.RSA|*.EC) from the jar, too.

tangens
  • 39,095
  • 19
  • 120
  • 139
0

One thing that makes a huge difference is how you tell Eclipse what tests you want to run.

When specifying the project name, our tests could take more than 5 minutes to be discovered (the 57%).

If we rather specify the directory containing the test source files, we are down to less than 30 seconds.

Eclipse Run config to specify which tests must be run