Skip to content

Commit 4fe2072

Browse files
committed
refactor(arch): Use ${project.groupId} for internal module dependencies
Internal (sibling-module) dependency entries and the parent's dependencyManagement hardcoded the literal groupId. Referencing it via the Maven property instead avoids repeating the same literal across every generated pom.xml and matches how ${project.version} is already used in the same dependencyManagement entries. External dependencies and the <parent> coordinate blocks are unaffected.
1 parent 8f4c8d3 commit 4fe2072

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/main/resources/META-INF/archetype-post-generate.groovy

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ def modulePom = { String gId, String prefix, String ver,
9696
if (deps) {
9797
def renderDep = { dep ->
9898
def isModuleRef = dep instanceof Map && dep.module
99-
def dGroup = (dep instanceof Map && !isModuleRef) ? dep.groupId : gId
99+
// Internal (sibling-module) deps always share this reactor's groupId, so reference it
100+
// via the Maven property rather than repeating the literal value in every dependency.
101+
def dGroup = (dep instanceof Map && !isModuleRef) ? dep.groupId : '${project.groupId}'
100102
def dArtifact = isModuleRef ? "${prefix}-${dep.module}" : ((dep instanceof Map) ? dep.artifactId : "${prefix}-${dep}")
101103
def dScope = (dep instanceof Map && dep.scope) ? "\n <scope>${dep.scope}</scope>" : ''
102104
def dExclusions = ''
@@ -370,7 +372,7 @@ def dmEntry = { String mod ->
370372
def scopeLine = (mod in DM_TEST_MODULES) ? '\n <scope>test</scope>' : ''
371373
"""\
372374
<dependency>
373-
<groupId>${groupId}</groupId>
375+
<groupId>\${project.groupId}</groupId>
374376
<artifactId>${artifactId}-${mod}</artifactId>
375377
<version>\${project.version}</version>${scopeLine}
376378
</dependency>"""

0 commit comments

Comments
 (0)