Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 355034

Summary: maven build does not trigger autosave
Product: z_Archived Reporter: gverspaij
Component: m2eAssignee: Project Inbox <m2e.core-inbox>
Status: CLOSED INVALID QA Contact:
Severity: normal    
Priority: P3 CC: amj87.iitr, igor, Olivier_Thomann
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description gverspaij CLA 2011-08-18 03:55:33 EDT
Build Identifier: 20110615-0604

When the workspace property 'Save automatically before build' is enabled files should be saved when maven build is executed

Reproducible: Always

Steps to Reproduce:
1. Enable property 'Save automatically before build' 
2. Change content of a java file whithout saving the file
3. Execute maven install
4. The java file isn't saved.
Comment 1 Ayushman Jain CLA 2011-08-18 05:38:56 EDT
I don't think this is an Eclipse bug. Maven should read the preference page and trigger a save when the user triggers a build. The bug should be reported in the Maven bugzilla.
Comment 2 Olivier Thomann CLA 2011-08-18 08:00:55 EDT
Moving to m2e
Comment 3 Igor Fedorenko CLA 2011-08-18 08:46:36 EDT
Assuming the issue is about RunAs->Maven_Install and similar, these are launch configurations and are NOT expected to follow 'Save automatically before build' preference. These launch configurations ARE expected to honour Run/Debug->Launching->Save_required_dirty_editors preference, which does not work either. 

MavenLaunchDelegate extends JavaLaunchDelegate and re-uses JDT standard save-on-launch logic, which is implemented in LaunchConfigurationDelegate.saveBeforeLaunch and uses AbstractJavaLaunchConfigurationDelegate.getBuildOrder to determine what files should be saved before launch. 

MavenLaunchDelegate needs to override #getBuildOrder to return affected workspace projects for launch configurations associated with a workspace project and return null for launch configurations that build projects outside of workspace. Or, even better, override #saveBeforeLaunch and handle the case when launching pom.xml nested inside a workspace project.

m2e development team has no immediate plans to work on this unless somebody provides a quality patch with adequate test coverage.
Comment 4 Igor Fedorenko CLA 2013-09-28 23:56:45 EDT
closing old/stale bugreports
Comment 5 Denis Roy CLA 2021-04-19 13:26:22 EDT
Moved to https://github.com/eclipse-m2e/m2e-core/issues/