Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 356796 - "GroupId is duplicate of parent groupId" warning generated
Summary: "GroupId is duplicate of parent groupId" warning generated
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: m2e (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-06 07:31 EDT by Son Mising name CLA
Modified: 2021-04-19 13:23 EDT (History)
8 users (show)

See Also:


Attachments
Removes the check altogether (5.98 KB, patch)
2011-12-16 15:30 EST, Hannes Schmidt CLA
no flags Details | Diff
Allows disabling of Pom Warning markers, using a workspace preferences page (8.88 KB, patch)
2012-05-13 09:04 EDT, Rob Newton CLA
no flags Details | Diff
Allows disabling of Pom Warning markers, using a workspace preferences page (12.10 KB, patch)
2012-05-17 06:19 EDT, Rob Newton CLA
igor: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Son Mising name CLA 2011-09-06 07:31:40 EDT
Build Identifier: M20110210-1200

i have existing maven projects (> 150) that reference as parent a single pom.
the pom is used to provide common configuration (custom plugins, dependency redefinitions to exclude some dependencies, ...)

therefore, all projects do reference the same parent pom: whether their own groupId might be the same as he parent's one or be different, it is specified.

i was using previous integration of the m2e (when hosted at sonatype) and it was running fine (except for some inconsistencies in the way (transitive) dependencies were resolved).

therefore i upgraded and found the current version very accurate.
however, since i started "converting" projects into 'Maven project', i noticed the message "GroupId is duplicate of parent groupId" when opening the pom in the editor ... and all projects are now flagged as containing warnings.

1- i searched the web and did not find conclusive information about this issue and the reason such warning is generated
(http://neo4j.org/forums/#nabble-td3217906)

2- i looked at the sources and (think) i found the code that generate the warning: org.eclipse.m2e.editor.xml.internal.MarkerLocationService in its static method checkParentMatchingGroupIdVersion ().

is it possible to disable such warning in the project as it now renders very difficult to figure whether its code related or that "warning" ?


Reproducible: Always

Steps to Reproduce:
1. have a parent-pom artifact in your maven repository
2. create a maven project in eclipse, referencing the parent-pom artifact as parent and using the same group id as new artifact definition
3. confirm the creation

the warning message appears.
Comment 1 Doug Bateman CLA 2011-10-24 22:28:27 EDT
I second this bug report.  If there is going to be a warning for Group-Id it should be made optional... and probably off by default.

I prefer to have my group-id listed in every pom to make copy-paste of the groupId+artifactId easy.  That's just my preference, of course.  Yet I don't find any best practices listed on any of the Maven websites to say this shouldn't be done.
Comment 2 Dave Hanson CLA 2011-12-08 13:16:13 EST
Another vote for this feature.

In large development efforts, it is sometimes not possible to force others to clean up the POMs that are not owned by you.

It would be nice to be able to configure on a project basis the ability to ignore this warning.
Comment 3 Igor Fedorenko CLA 2011-12-08 13:18:26 EST
(In reply to comment #2)
> Another vote for this feature.
> 
> In large development efforts, it is sometimes not possible to force others to
> clean up the POMs that are not owned by you.
> 
> It would be nice to be able to configure on a project basis the ability to
> ignore this warning.

Where do you plan to keep per-project configuration? Wouldn't this imply ability to change the project sources?
Comment 4 Hannes Schmidt CLA 2011-12-15 18:41:54 EST
Both warnings, "GroupId is duplicate of parent groupId" and "Version is duplicate of parent version" are misleading. Maven doesn't warn about this situation and neither should m2e. 

Here is an example where the "Version is duplicate of parent version" warning is actually dangerous: After releasing a non-reactor parent, when preparing to release the children, I have to change the project/parent/version of the children to refer to the just released parent. Assuming that I had taken this warning seriously and removed the "redundant" project/version element from the child POMs, I would now have to add it again since it's now different to project/parent/version. Here is the catch: If I forget, my children will silently and coincidentally be build as non-SNAPSHOT without having been released properly.  Sometimes redundancy is a good thing.

Bottom line: these two validations should be removed or made optional via configuration. There are many Eclipse plugins that perform validation and have the ability to disable/enable warnings globally and per-project. M2e should be consistent with those plugins.
Comment 5 Doug Bateman CLA 2011-12-15 21:10:41 EST
I'm okay with it being a global option instead of per-project.  I'd even be okay with removing the warning outright, as it really doesn't make sense.  Extraneous warnings only serve to detract attention away warnings that really matter.
Comment 6 Igor Fedorenko CLA 2011-12-15 21:12:25 EST
Please provide a quality patch and review and apply it.
Comment 7 Hannes Schmidt CLA 2011-12-16 15:30:51 EST
Created attachment 208505 [details]
Removes the check altogether

Attached patch removes the warning.
Comment 8 Igor Fedorenko CLA 2011-12-16 15:34:05 EST
(In reply to comment #7)
> Created attachment 208505 [details]
> Removes the check altogether
> 
> Attached patch removes the warning.

No, this needs to be optional. We can discuss whether this is workspace-global or per-project configuration.
Comment 9 Hannes Schmidt CLA 2011-12-16 22:26:01 EST
(In reply to comment #8)

> No, this needs to be optional. We can discuss whether this is workspace-global
> or per-project configuration.

I don't know how to do that, sorry. I've spent more time on this than is worth it. I guess we'll just have to live with this annoyance.
Comment 10 Daniel Tischer CLA 2012-03-02 04:06:33 EST
If you don't specify groupId in your pom.xml, then the Sonar link in Jenkins won't work. Of course you could argue that it's a sonar plugin problem, but why throw a warning for something that's not a problem, but causing a problem when you fix the warning?
Comment 11 Rob Newton CLA 2012-04-25 21:51:14 EDT
I too am very keen to see these warning messages disabled.  Are there any plans to get that patch or something similar applied to the Indigo updates channel?
Comment 12 Igor Fedorenko CLA 2012-04-25 23:00:55 EDT
Definitely not Indigo and it's almost too late for Juno. There are no plans to accept the patch proposed in comment 7.
Comment 13 Hannes Schmidt CLA 2012-04-26 00:39:04 EDT
Igor, please provide your reasoning as to why the "version/groupId is duplicate of paren version/groupId" warnings are useful. The commenters on this issue seem to favor the removal of the warning while you have given no indication as to why *you* think it makes any sense.
Comment 14 Rob Newton CLA 2012-05-06 20:41:36 EDT
(In reply to comment #12)
> Definitely not Indigo and it's almost too late for Juno. There are no plans to
> accept the patch proposed in comment 7.

Thanks for the update Igor.  Are there any plans for a facility to enable/disable warnings of the m2e plugin?
Comment 15 Igor Fedorenko CLA 2012-05-06 20:54:09 EDT
(In reply to comment #14)
> (In reply to comment #12)
> > Definitely not Indigo and it's almost too late for Juno. There are no plans to
> > accept the patch proposed in comment 7.
> 
> Thanks for the update Igor.  Are there any plans for a facility to
> enable/disable warnings of the m2e plugin?

I am okay with workspace preferences to enable/disable this and other pom.xml error markers but somebody will have to provide a quality patch before anything happens.
Comment 16 Rob Newton CLA 2012-05-13 09:04:57 EDT
Created attachment 215536 [details]
Allows disabling of Pom Warning markers, using a workspace preferences page

Igor, I hope you find this a "quality patch" and accept it for Juno.  :-)
Comment 17 Hannes Schmidt CLA 2012-05-13 16:27:52 EDT
(In reply to comment #16)
> Created attachment 215536 [details]
> Allows disabling of Pom Warning markers, using a workspace preferences page
> 
> Igor, I hope you find this a "quality patch" and accept it for Juno.  :-)

Thank you, thank you, thank you!!!
Comment 18 Igor Fedorenko CLA 2012-05-16 22:39:26 EDT
The patch overall looks reasonable and is small enough to sneak in RC1. I have couple of questions/requests before I can apply it

* Do you really mean to add Sonatype copyright header to WarningsPreferencePage? Usually you put your name or name of your employer on the new files you crate and add yourself to the list of contributors in files you modify.
* Can you confirm here that you : (a) wrote 100% of the code; (b) that they have the right to contribute the code to Eclipse; and (c) the file header contains the appropriate License header (see the thoroughly entertaining IP poster http://www.eclipse.org/legal/EclipseLegalProcessPoster.pdf).
* Attached git-format-patch formatted patch, so the commit is properly credited to yourself in git log.

I will be doing some RC1 preparation work over the coming (long) weekend, so it'd be nice if you could answer by then. Otherwise this patch will likely have to wait until after Juno...
Comment 19 Rob Newton CLA 2012-05-17 06:19:03 EDT
Created attachment 215757 [details]
Allows disabling of Pom Warning markers, using a workspace preferences page

Hi Igor,

Thanks for the explanations and suggestions (this is all new to me).

I've followed your instructions on the copyright in the headers, and made a git-format-patch this time.

I wrote 100% of the code in my personal time and have the right to commit the code to Eclipse.

Cheers,
Rob
Comment 20 Igor Fedorenko CLA 2012-05-20 11:40:58 EDT
Applied the patch, thank you. In the future, please use git-format-patch formatted patch.


http://git.eclipse.org/c/m2e/m2e-core.git/
Comment 22 Denis Roy CLA 2021-04-19 13:23:50 EDT
Moved to https://github.com/eclipse-m2e/m2e-core/issues/