Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 340159 - Build participants receive stale MavenProject(Facade) during incremental build after POM change
Summary: Build participants receive stale MavenProject(Facade) during incremental buil...
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: m2e (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Paul Tatavu CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-16 10:05 EDT by Benjamin Bentmann CLA
Modified: 2021-04-19 13:26 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Bentmann CLA 2011-03-16 10:05:29 EDT
During the incremental build that follows a change to the POM, the m2e build participants suffer from a stale MavenProject instance being passed to them which does not reflect the POM change which has just been made. One user-visible effect of this is are error markers which basically reflect the previous POM contents but not the current.

At least one piece of the error is the following code from MavenBuilder:

    if(projectFacade.isStale()) {
      MavenUpdateRequest updateRequest = new MavenUpdateRequest(project, mavenConfiguration.isOffline() /*offline*/,
          false /*updateSnapshots*/);
      projectManager.refresh(updateRequest, monitor);
      IMavenProjectFacade facade = projectManager.create(project, monitor);
      if(facade == null) {
        // error marker should have been created
        return null;
      }
    }

While this code properly detects the isStale() state, the newly re-recreated facade object is not used, i.e. doesn't replace the stale projectFacade instance.
Comment 1 Fred Bricon CLA 2011-03-18 19:23:52 EDT
This issue is bugging me while I'm trying to trigger web resource filtering when the pom.xml changes. Project property values used during filtering correspond to the previous state of the pom.
Comment 2 Paul Tatavu CLA 2011-03-30 14:22:56 EDT
Fixed indirectly by the fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=340892
Comment 3 Benjamin Bentmann CLA 2011-03-31 07:42:29 EDT
(In reply to comment #2)
> Fixed indirectly by the fix for
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=340892

It appears since this change, build participants now longer observe a resource change delta in which the pom file is indicated as modified. Is this intentional/desired? If so, what is the recommended approach for build participants to tell whether the POM has been edited since the last build?
Comment 4 Paul Tatavu CLA 2011-03-31 11:13:07 EDT
The change was not intentional.
Comment 6 Denis Roy CLA 2021-04-19 13:26:52 EDT
Moved to https://github.com/eclipse-m2e/m2e-core/issues/