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

Bug 343674

Summary: Renaming Maven artifact does not change groupId in child modules
Product: z_Archived Reporter: Francisco Gortázar <patxi.gortazar>
Component: m2eAssignee: Project Inbox <m2e.core-inbox>
Status: CLOSED INVALID QA Contact:
Severity: normal    
Priority: P3 CC: igor, mkleint
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Francisco Gortázar CLA 2011-04-22 18:02:41 EDT
I had a project with several modules with groupId:

es.sidelab.pascaline

Modules had a POM like this one:

<parent>
  <artifactId>parent</artifactId>
  <groupId>es.sidelab.pascaline</groupId>
  <version>1.0.1-SNAPSHOT</version>
  <relativePath>../es.sidelab.pascaline.parent</relativePath>
</parent>

<groupId>es.sidelab.pascaline</groupId>	
<artifactId>net.sf.pascaline.cdtinterface</artifactId>
<packaging>eclipse-plugin</packaging>

I made a rename refactor to change the groupId to es.sidelab.pascaline.ide.

The parent project was updated perfectly, but child modules were only updated partialy. This is the POM I ended up with in my child modules:

<parent>
  <artifactId>parent</artifactId>
  <groupId>es.sidelab.pascaline.ide</groupId>
  <version>1.0.1-SNAPSHOT</version>
  <relativePath>../es.sidelab.pascaline.parent</relativePath>
</parent>
	
<groupId>es.sidelab.pascaline</groupId>	
<artifactId>net.sf.pascaline.cdtinterface</artifactId>
<packaging>eclipse-plugin</packaging>


The groupId within the parent section was updated, but the groupId outside this section remained the same. I decided not to list the groupId in child POMs, and let Maven resolve the groupId from the parent definition. However, I think the plugin should change child modules groupId declarations if the groupId matches the groupId of parent project.

I'm using m2e version 0.12.1.
Comment 1 Igor Fedorenko CLA 2011-04-22 20:00:50 EDT
Observed behaviour is correct. Rename refactoring is only updates references to the artifact being renamed. It is not expected to make any other changes.
Comment 2 Milos Kleint CLA 2011-04-23 02:13:47 EDT
You don't have to duplicate the groupId declaration in the child modules (if the groupId is the same). If you want to keep all groupIds in sync, the best solution is to omit the groupId declaration in children.

In the editor (in 0.13.x) we provide a warning hint that points out that you have duplicate groupId declaration in child and suggest to remove it.
Comment 3 Denis Roy CLA 2021-04-19 13:26:16 EDT
Moved to https://github.com/eclipse-m2e/m2e-core/issues/