Justin
Justin

Reputation: 6251

Eclipse loops endlessly: Invoking 'Maven Project Builder'

Ugh! My Eclipse is stuck in an endless loop:

The building workspace never gets past 58%.

Details:

Google's GWT provides a sample app MobileWebApp. They suggest adding it to Eclipse via File > Import > Checkout Maven projects from SCM.

I followed the instructions in this blog for adding the plugins for m2e, subclipse, and the m2e-subclipse connector.

After installing the plugins, I imported the sample project via File > Import > Checkout Maven projects from SCM and this URL.

The import seemed to complete ok and Eclipse doesn't display any markers. But now I have this endless refreshing and building and have no clue what is causing it or how to fix it.

Versions:

Any advice is greatly appreciated.

Upvotes: 56

Views: 44090

Answers (20)

Nathan
Nathan

Reputation: 8940

I open the progress window in Eclipse and see the Maven Project Builder progressing. At some point, it creates another Maven Project Builder. This second Maven Project Builder is blocked waiting. I click on the red X to delete this second one. The first one finishes and the loop does not continue.

Upvotes: 0

Oussama Ouardini
Oussama Ouardini

Reputation: 461

If none of the above solutions work

uncheck:

Project -> Build Automatically

Upvotes: 0

Lonzak
Lonzak

Reputation: 9816

In addition to the accepted answer there are two similar cases: In the module's .project file there could be two redundant entries and deleting one helped.

<projectDescription>
...
 <buildSpec>
   <buildCommand>
    <name>org.eclipse.m2e.core.maven2Builder</name>
    <arguments>
    </arguments>
   </buildCommand>
   <buildCommand>
    <name>org.eclipse.m2e.core.maven2Builder</name>
    <arguments>
    </arguments>
   </buildCommand>

And the 2nd one is two different maven natures:

<projectDescription>
...
 <buildSpec>
   <natures>
     <nature>org.eclipse.m2e.core.maven2Nature</nature>
     <nature>org.maven.ide.eclipse.maven2Nature.</nature>
   </natures>

Removing org.maven.ide.eclipse.maven2Nature helps in that case.

Upvotes: -1

Fred Campos
Fred Campos

Reputation: 1617

I opened my module's .project file. There were two entries:

<buildCommand>
  <name>org.maven.ide.eclipse.maven2Builder</name>
</buildCommand>
<buildCommand>
  <name>org.eclipse.m2e.core.maven2Builder</name>
</buildCommand>

I removed org.eclipse.m2e.core.maven2Builder entry and it magically fixed the problem.

Upvotes: 31

S0haib Nasir
S0haib Nasir

Reputation: 242

In my case, I was working with react so running node using frontend plugin. If node is running then it stucks on Invoking 'Maven Project Builder'. I closed node and invoking was completed asap. Node instance running in eclipse was creating issue. I am using windows so going into task manager I closed node instances like shown in image and it works fine. You can check if there is any instance under eclipse which is causing issue. enter image description here

Upvotes: 0

Cyb3r
Cyb3r

Reputation: 3

Eclipse -> Preferences -> Maven -> Installations Remove additional installation and using EMBEDDED helped me.

The trigger was, that I wanted to have a separated maven setup for SLF4J: Class path contains multiple SLF4J bindings.

Upvotes: 0

Markus Hettich
Markus Hettich

Reputation: 574

The problem can be a code generating plugin like the openapi-generator-maven-plugin or the protoc-jar-maven-plugin. Such plugins are generating code that retriggers the eclipse compilation. A solution to prevent this behavior could be to disable the plugin for the Eclipse "Maven Project Builder". This can be done by adding an entry to the pom.xml like described here: https://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html

<pluginManagement>
    <plugins>
        <plugin>
            <groupId>org.eclipse.m2e</groupId>
            <artifactId>lifecycle-mapping</artifactId>
            <version>1.0.0</version>
            <configuration>
                <lifecycleMappingMetadata>
                    <pluginExecutions>
                        <!-- Add plugin execution configuration here -->
                    </pluginExecutions>
                </lifecycleMappingMetadata>
            </configuration>
        </plugin>
    </plugins>
</pluginManagement>

Such Plugin configuration could look like similar to the following example:

<pluginExecution>
  <pluginExecutionFilter>
    <groupId>org.openapitools</groupId>
    <artifactId>openapi-generator-maven-plugin</artifactId>
    <versionRange>[0.0,)</versionRange>
    <goals>
      <goal>generate</goal>
    </goals>
  </pluginExecutionFilter>
  <action>
    <ignore />
  </action>
</pluginExecution>

Alternatively such settings could be done globally for a eclipse workspace: Window > Preferences > Maven > Lifecycle Mappings. More about this topic can be read here: https://www.benchresources.net/eclipse-maven-plugin-execution-not-covered-by-lifecycle-configuration/

Upvotes: 2

JohnEye
JohnEye

Reputation: 6895

This was happening to me after a project I cloned from GitHub changed its structure to multi-module Maven project. Since some eclipse-specific files were in .gitignore, doing git pull kept the originals even after I removed the old project from Eclipse and re-imported it as new with submodules. This apparently caused some chaos leading to the issue.

Nuking the project directory and re-cloning the project resolved the issue.

Upvotes: 0

Komal Singh Sisodiya
Komal Singh Sisodiya

Reputation: 31

Delete project from eclipse(not from disk). And import as "General>Existing Projects into Workspace"

Upvotes: 0

Marcelo Brito
Marcelo Brito

Reputation: 1

I had the same problem. It turns out that I was running Eclipse with the pipe (|) operator, running another process in parallel. The other process was jamming my Eclipse thread. Once I shut down the other process, Eclipse worked fine.

Upvotes: -1

Matthias
Matthias

Reputation: 1

I linked some files in eclipse but the source file was missing (deleted in the meantime). This caused eclipse to restart the build. Deleting the broken link solved the problem.

Upvotes: 0

user10116596
user10116596

Reputation: 1

Eclipse on my workstation hangs every time I try to update maven project. The issue is not resolved even after trying a lot of resolutions/workarounds suggested by community. The only thing that works for me is to run mvn clean and install commands from command prompt. I end the task in task manager, run mvn commands and then re-launch eclipse. Running clean build after re-launching eclipse works fine.

Upvotes: 0

Parthi
Parthi

Reputation: 123

  1. I have configured the java environment variable properly (i.e., JAVA_HOME).
  2. Also added the jdk path to the environment variable path, in my case path is C:\Program Files\Java\jdk1.8.0_101\bin.
  3. Also I added path to JDK home in "Installed JREs" preference in Eclipse.

Not sure which one of this resolved the issue, I don't see auto build happening now.

After this, I created a new maven project. Which was set to use the 1.7 by default, this project too resulted in endless loop. But 1.7 is not configured in eclipse. Updating the project properties to use the java version available in my eclipse has resolved the issue.

Upvotes: 0

Francisco M
Francisco M

Reputation: 193

I did something similar to Amos M. Carpenter response (https://stackoverflow.com/a/28713259/4470352)

But also I created a new custom builder with the following configuration:

  1. Choose configuration type -> Program
  2. Location (text box) <= D:\apache-maven-3.3.9\bin\mvn.cmd (my custom maven)
  3. Working Directory (text box) <= ${workspace_loc:/project}
  4. Arguments (text area)
    • <= clean compile test-DproxySet=true -DproxyHost=a.proxy.host -DproxyPort=8080

This compiles me the project with no progress bar, but i can see the progress in text console.

The problem in my case is that every time I compile that project, I download a WSDL and I need to provide proxy configuration. When maven project builder plug-in tries to compile my project, fails and starts again in a loop.

I have tried to setup it into settings.xml maven configuration file, but doesn't work for me, and providing proxy configuration in command line works.

So creating that custom builder does the job and is a new approach.

I hope it to helps you.

Upvotes: 0

hitesh karel
hitesh karel

Reputation: 11

This issue generally also comes when maven unable to delete some file may that is having too long name. So you can manually go to your target folder and clean it and restart eclipse.

Upvotes: 1

Amos M. Carpenter
Amos M. Carpenter

Reputation: 4958

I was getting the same issue in an eclipse (Juno) Maven project that had nothing to do with GWT - it just kept refreshing and "Invoking Maven Project Builder". Going to the Progress view and requesting a cancellation of either progress entry (by clicking that red stop button on the right) didn't help.

The project the builder kept getting stuck on was always the same, and a couple of levels deep in a set of multi-pom maven projects in eclipse.

What eventually solved it for me was just going into that particular project's Properties > Builders and unchecking Maven Project Builder (but keeping the Java Builder checked so that it would still auto-build when code changed). I just ignored the warning about this being an "advanced operation" and possibly having "many side-effects" - I figured it couldn't be any more annoying than that constant build-refresh cycle. I'm still not sure what the cause of this loop was, but that stopped it for me. And I haven't had any problems since.

Upvotes: 21

99Sono
99Sono

Reputation: 3687

M2e, even in eclipse mars, seems to like infinite building.

In my case, no such thing as repeated build commands, as listed bellow. The only thing that seems to work when the project tree is gigantic is:

  1. open eclipse
  2. Disable build automatically as soon as you open eclipse
  3. refresh the workspace and trigger manual a Crtl+B or a build all.
  4. Once eclipse is satisfied that it build the full project tree ... better have four core machine or you're gonna be waiting a while, you can finely put the build automatically option active. Eclipse seems not to go in a building spree after that. It will still go for a while scanning some folders, but activating the build automatically - once you've built it all before - is much faster than a new build all, and finally, eclipse becomes stable stops building infinitely.

Otherwise, you're stuck with the deprecated mvn eclipse:eclipse ... and have to abandon the use of maven commands from within eclipse echosystem. M2e seems to have a really gigantic hard time cooperating with the beast.

I still use m2e, but must say it is 100 times more difficult to swallow m2e than maven integration in netbeans. On the otherhand, eclipse is much faster for very large code base. Pick your poison, you'll always get bitten.

 <?xml version="1.0" encoding="UTF-8"?>
    <projectDescription>
        <name>rootPom</name>
        <comment></comment>
        <projects>
        </projects>
        <buildSpec>
            <buildCommand>
                <name>org.eclipse.m2e.core.maven2Builder</name>
                <arguments>
                </arguments>
            </buildCommand>
        </buildSpec>
        <natures>
            <nature>org.eclipse.m2e.core.maven2Nature</nature>
        </natures>
    </projectDescription>

Upvotes: 2

Chris Hinshaw
Chris Hinshaw

Reputation: 7255

I actually solved the problem that was caused by the jaxb plugin. If the forceRegenerate is set to true you will get the build loop in eclipse (Kepler in my case).

Verify that you have forceRegenerate set to false in your maven-jaxb-plugin.

<configuration>                                  
    <forceRegenerate>false</forceRegenerate>
</configuration>

Upvotes: 11

Abhi
Abhi

Reputation: 6568

it some times worked for me when i change my JAVA_HOME to a new location

Upvotes: 0

Justin
Justin

Reputation: 6251

I was able to resolve this by right clicking on the project and selecting Run As > Maven Clean

Upvotes: 22

Related Questions