Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 405661 - classpathentries are updated even when they are not marked as maven.pomderived
Summary: classpathentries are updated even when they are not marked as maven.pomderived
Status: CLOSED WONTFIX
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: m2e (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-13 01:16 EDT by Thomas Hallgren CLA
Modified: 2021-04-19 13:25 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Hallgren CLA 2013-04-13 01:16:29 EDT
m2e alters classpathentry entries in the .classpath file that are not marked as maven.pomderived. Here's an example:

I have a folder named src/main/resources where I keep a couple of non-java files. The .classpath file contains the following line:

 <classpathentry kind="src" output="target/classes" path="src/main/resources"/>

Even though this line does not have a "maven.pomderived" attribute declared, it is always changed into:

 <classpathentry including="**/*.java" kind="src" output="target/classes" path="src/main/resources"/>

so anyone using the project in an IDE where m2e is not installed will now get errors when trying to run.

I would expect m2e to leave lines that are not specifically marked with maven.pomderived="true" alone.

See http://dev.eclipse.org/mhonarc/lists/m2e-users/msg03925.html for more details and background discussion.
Comment 1 Cuong Tran CLA 2014-02-20 19:18:09 EST
Is there any update on this issue?
Comment 2 Igor Fedorenko CLA 2014-02-20 20:10:54 EST
No, no update. I have no plans to look at this issue unless a quality patch is provided. I am not even decided if this is a bug or works as expected.
Comment 3 Thomas Hallgren CLA 2014-07-06 01:49:20 EDT
I could look into this but the fact that Igor haven't decided if this is a bug or not worries me. Please note that it doesn't matter if the maven.pomderived attribute is missing or if it's explicitly set to false. The entry is *always* overwritten regardless. The maven.pomderived attribute seems to be completely ignored at all times. Surely that must be a bug?
Comment 4 Igor Fedorenko CLA 2014-07-06 03:34:05 EDT
The indent of maven.pomderived=true was to enable cleanup of stale classpath entries generated based on pom.xml configuration. This is specifically explained in the javadoc, so the observed behaviour is not a bug according to javadoc. You can also see original bug 353266.

What you request is to change the API to something like "m2e never touches classpath entries if pom.derived=false or not specified". I don't think I understand all consequences of such a change without trying it out.

If you decide to work on a patch, the new behaviour should apply to all classpath entries, not just resources folder. There should also be new API to remove and/or modify custom classpath entries.

I also think import wizard and update configuration dialog should provide a way to reset custom entries, possible a checkbox which is unchecked by default.
Comment 5 Thomas Hallgren CLA 2014-07-07 06:04:42 EDT
(In reply to Igor Fedorenko from comment #4)
> ... This is specifically explained in the javadoc, so the observed behaviour
> is not a bug according to javadoc.

From the javadoc of setPomDerived(boolean derived):

 Not-derived (or custom) entries are preserved during project configuration
 update, while derived entries are automatically removed whenever their
 corresponding pom.xml configuration is changed or removed.

Can you please explain to me what the difference is between "not-derived" and "custom" entries?
Comment 6 Igor Fedorenko CLA 2014-07-07 07:09:46 EDT
(In reply to Thomas Hallgren from comment #5)
> (In reply to Igor Fedorenko from comment #4)
> > ... This is specifically explained in the javadoc, so the observed behaviour
> > is not a bug according to javadoc.
> 
> From the javadoc of setPomDerived(boolean derived):
> 
>  Not-derived (or custom) entries are preserved during project configuration
>  update, while derived entries are automatically removed whenever their
>  corresponding pom.xml configuration is changed or removed.
> 
> Can you please explain to me what the difference is between "not-derived"
> and "custom" entries?

No difference, "not-derived" and "custom" are two ways to name the same thing.
Comment 7 Thomas Hallgren CLA 2014-07-07 07:56:40 EDT
It seems this mechanism is only good for keeping non-pomderived *paths* intact, not the entries per se. The m2e generated entry will always overwrite a custom entry when there's a path conflict.

I can understand the need for that approach (how else would the initial classpath be generated) but I think there's a need for something that actually do preserve custom entries in case of path conflicts (a maven.noclobber or something). That, and perhaps a clarification in the javadoc regarding the true meaning of pomderived. To me "preserve" means - do not overwrite with generated stuff.
Comment 8 Igor Fedorenko CLA 2014-07-09 08:11:20 EDT
I don't think we need new 'noclobber' attribute, just new API to remove/replace custom classpath entries and UI action to remove all custom classpath entries (during configuration update, for example).
Comment 9 Tobias Oberlies CLA 2014-07-11 07:12:46 EDT
(In reply to comment #8)
> I don't think we need new 'noclobber' attribute, just new API to remove/replace
> custom classpath entries and UI action to remove all custom classpath entries
> (during configuration update, for example).
Does this prevent that normal "update projecs" overwrite an intentionally, manually modified classpath entry, e.g. for the JRE (as needed by the tycho-p2-director-plugin module, cf. bug 439426)?
Comment 10 Igor Fedorenko CLA 2014-07-11 08:42:36 EDT
Yes, I believe m2e will overwrite manually configured JRE_CONTAINER classpath container.
Comment 11 Eclipse Genie CLA 2015-07-12 05:13:50 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 12 Denis Roy CLA 2021-04-19 13:25:01 EDT
Moved to https://github.com/eclipse-m2e/m2e-core/issues/