1

I have a number of multi-module Maven projects all of which build continously. This is a well-known problem but none of the suggested solutions have helped.

  • Turn off Project->Build Automatically, Project->Clean...
  • Check .project for multiple maven2Builder entries

The project structure is

parent
  +--model (jar)
  +--client (jar)
  +--restservice (war)

Both client and restservice have dependencies on model. These 2 modules build continuously but, as far as I can, tell they do not cause any changes in the model module.

Is there any way to track down what is causing this? Is there any tracing which might indicate what the trigger is?

Update

  • I have executed the parent POM in a terminal and this runs successfully
  • The Maven Workspace View shows all modules are continuously being built. The parent has no execution but has a delta which lists artifacts from all child modules

Maven Workspace View

UPDATE

I have created a bare-bones example on github https://github.com/pramsden/openapiproblem which demonstates the endless build-loop problem.

paul
  • 13,312
  • 23
  • 81
  • 144
  • I would try to detect if there are any changes to the `model` module on file-system level using OS dependent tools (Process Monitor on Windows, inotify-tools on Linux). May be Eclipse is not the problem at all and a third party program running in background is causing this trouble? – Robert Apr 09 '21 at 13:39
  • 1
    The _Maven Workspace Build_ view is for this purpose. – howlger Apr 09 '21 at 13:39
  • Does building from the command line work? Can you show the three `pom.xml` files? – dan1st Apr 09 '21 at 13:46
  • @howlger can you point me to a description of how the `Maven Workspace Build` view can be used to identify the triggers? Are the files listed in `delta` the files which cause the build of that project? – paul Apr 13 '21 at 07:30
  • Yes, any of these file changes shown in the _Maven Workspace Build_ view, including touching a file without changing its content, triggers a new project build: https://www.eclipse.org/lists/m2e-users/msg04748.html Does the problem persist when you press the _Suspend_ button in the upper right? – howlger Apr 13 '21 at 07:41
  • @dan1st I have put them on github: https://github.com/pramsden/openapiproblem – paul Apr 19 '21 at 07:01

1 Answers1

0

The problem seems to have been caused by the openapi code generation in the modules. The parent detected changes and triggered a rebuild.

I found this answer https://stackoverflow.com/a/64960032/11249 and I added the following to the parent POM:

<build>
    <pluginManagement>
        <plugins>
            <!-- prevents generated code from triggering a rebuild -->
            <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>
                            <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>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
</build>

The Maven build executes just once and no further automatic builds are performed.

paul
  • 13,312
  • 23
  • 81
  • 144