[ https://issues.apache.org/jira/browse/ARCHETYPE-552?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16943200#comment-16943200 ]
Scott MacDonald edited comment on ARCHETYPE-552 at 10/2/19 10:11 PM: --------------------------------------------------------------------- Just ran into this exact issue on maven 3.6.2 with the bundled archetype plugin, and it also occurs on latest 3.2.1 archetype plugin. Came here to log a bug and and submit a minimal reproducible case, but low and behold, somebody already did...me!! hah! over a year ago!! Well that saves me little time (not as much as if I remembered I did that 2 hours ago...ha) . Anyway, sure hope somebody can fix this cuz using a sibling parent with an aggregator pom that inherits from it is a pretty nice pattern. Many people separate aggregation and inheritance this way. I've use this pattern on hundreds of projects and it work well. I just can't generate working templated projects for them with the archetype plugin. A none ideal workaround is to break the inheritance from the aggregator to the parent, and then specify version in the aggregator, which isn't ideal cuz DRY....and I also have call versions:set twice to change them (once on aggregator, once on parent). Not a huge deal, but it would be wonderful if it archetype didn;t erroneously add the inheritance cycle in the first place. was (Author: scanguskhan): Just ran into this exact issue on maven 3.6.2 with the bundled archetype plugin, and it also occurs on latest 3.2.1 archetype plugin. Came here to log a bug and and submit a minimal reproducible case, but low and behold, somebody already did...me!! hah! over a year ago!! Well that saves me little time (not as much as if I remembered I did that 2 hours ago...ha) . Anyway, sure hope somebody can fix this cuz using a sibling parent with an aggregator pom that inherits from it is pretty nice pattern. (man people separate aggregation and inheritance this way) I've use this pattern on hundreds of projects. . I just can't generate working templated projects for therm with the archetype plugin. A none ideal workaround is to break the inheritance from the aggregator to the parent, and then specify version in the aggregator, which isn't ideal cuz DRY....and I also have call versions:set twice to change them (once on aggregator, once on parent). Not a huge deal, but it would be wonderful if it archetype didn;t erroneously add the inheritance cycle in the first place. > Erroneous Inheritance Cycle Generated By Archetype Plugin > --------------------------------------------------------- > > Key: ARCHETYPE-552 > URL: https://issues.apache.org/jira/browse/ARCHETYPE-552 > Project: Maven Archetype > Issue Type: Bug > Components: Plugin > Affects Versions: 3.0.1 > Reporter: Scott MacDonald > Priority: Major > Attachments: maven-archetype-parent-cycle-bug.zip > > > When developing a multi module archetype with a root level aggregator pom > which inherits from a sibling parent within the project, the archetype > generated project will incorrectly add the aggregator pom as a parent in the > sibling parent pom file, causing an inheritance cycle in the generated > project. > Attached is a zip file containing a minimal archetype project that > demonstrates the behavior. > After running mvn install, you can inspect > target/test-classes/projects/it-basic/project/example-project/example-project-parent/pom.xml > and see that the generated project incorrectly adds the top-level aggregate > pom as a parent in the parent pom causing an inheritance cycle, even though > such a parent designation is not specified in the archetype resources. > > The exact element that is incorrectly added to > target/test-classes/projects/it-basic/project/example-project/example-project-parent/pom.xml > is below.. > <parent> > <artifactId>example-project-aggregator</artifactId> > <groupId>com.foo</groupId> > <version>0.0.0</version> > </parent> > > After the failure, removing the incorrect parent pom element from the > target/test-classes/projects/it-basic/project/example-project/example-project-parent/pom.xml > results in a working maven project. > > -- This message was sent by Atlassian Jira (v8.3.4#803005)