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

Bug 353266

Summary: preserve custom .classpath entries during project import and configuration update
Product: z_Archived Reporter: Shaun Elliott <javamonkey79>
Component: m2eAssignee: Igor Fedorenko <igor>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: igor
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Shaun Elliott CLA 2011-07-27 21:28:56 EDT
Steps to reproduce:

1) Create pre-Indigo maven project with an additional source folder, eg: 'src/main/webapp'

2) Check the project into svn source control 

3 a) Check the project out (not as a maven project) and then run Configure -> Convert to Maven Project in the package explorer

3 b) Check the project out as as Maven Project via the scm connector (SVN in our case)

Additional source resources from the classpath are missing. eg: 
<classpathentry kind="src" path="src/main/webapp"/>
Comment 1 Igor Fedorenko CLA 2011-07-27 22:37:52 EDT
So, in other words, you expect m2e to preserve custom (i.e. not created by m2e from pom.xml) java source folders to be preserved during project import and configuration update. Did I get this right?
Comment 2 Shaun Elliott CLA 2011-07-28 02:34:13 EDT
No, you did not get it right. I would not expect m2e to take responsibility for retention of source folders. My concern is only with the .classpath file.

From what I can tell, the .classpath file is completely overwritten. Other plugins also use the .classpath file I think that completely overwriting it is the wrong approach. 

Why not simply check for the needed components, if they're not there then add them? This seems like it would be a fairly trivial change, and would not really cost much in the way of performance either. This way you wouldn't have to worry about unnecessary removal.

I hope this clears it up. Thanks for your help.
Comment 3 Igor Fedorenko CLA 2011-07-28 05:03:07 EDT
This is what I mean, you expect m2e to retain custom .classpath source folder entries (or maybe just all custom .classpath entries) during project import and configuration update.

My only concern here is accumulation of stale .classpath entries created by m2e because there is currently no way to if .classpath entry was created by m2e or not. But this is an implementation detail ;-)
Comment 4 Shaun Elliott CLA 2011-08-09 13:43:21 EDT
Would submitting a patch expedite this?
Comment 5 Igor Fedorenko CLA 2011-08-09 13:59:52 EDT
(In reply to comment #4)
> Would submitting a patch expedite this?

Yes, it would. Beware, though, that Indigo RC1 is pretty much done at this point and we do not plan to make official releases until Juno.
Comment 6 Igor Fedorenko CLA 2011-09-21 23:15:55 EDT
This is implemented (see [1] and corresponding tests [2]) and I plan to integrate this soon after Juno M2 build next week.


[1] http://git.eclipse.org/c/m2e/m2e-core.git/log/?h=353266-custom-classpath-entries
[2] https://github.com/sonatype/m2e-core-tests/tree/353266-custom-classpath-entries
Comment 7 Igor Fedorenko CLA 2011-09-27 20:30:33 EDT
the changes have been merged to master.
Comment 8 Denis Roy CLA 2021-04-19 13:26:19 EDT
Moved to https://github.com/eclipse-m2e/m2e-core/issues/