apache / apache/maven-archetype

create-from-project + -Darchetype.preserveCData + multi-module + dependency is broken

Open
#983 1 comment 0 reactions 0 assignees Claimed by @lalmeras View on GitHub
bug
Dominant language
Java
Stars
148
Forks
181
Avg merge
1d 20h
Merged PRs (30d)
8

Description

### Affected version

3.4.1

### Bug description

When a multi-module project is used with create-from-project with preserveCData, dependencies between modules are broken.

For the following hierarchy :
* A
* B
* C -> B

The built archetype replace B dependency in C module with a A dependency.

From my investigation, bug originates from FilesetArchetypeCreator#createModulePoms, when artifactId/parentArtifactId properties are saved then restored while processing modules. parentArtifactId is restored with the currently processed artifactId instead of previous parentArtifactId (i.e. when B is processed, parentArtifactId is restored to B value instead of A).

The bug triggers only when preserveCData is used, surely because pom model is used instead of parentArtifactId when preserveCData is false.

I prepare a PR with an integration test and a fix proposal.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at FilesetArchetypeCreator#createModulePoms and trace how artifactId and parentArtifactId are saved and restored while processing modules with preserveCData. Review the integration test described in the issue and verify the A/B/C hierarchy preserves C's dependency on B when the archetype is created.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.