Neil-Tomar commented on code in PR #414:
URL: https://github.com/apache/maven-help-plugin/pull/414#discussion_r3835494211
##########
src/main/java/org/apache/maven/plugins/help/EffectivePomMojo.java:
##########
@@ -178,7 +178,7 @@ private boolean shouldWriteAllEffectivePOMsInReactor() {
* @throws MojoExecutionException if any
*/
private void writeEffectivePom(MavenProject project, XMLWriter writer)
throws MojoExecutionException {
- Model pom = project.getModel();
+ Model pom = project.getModel().clone();
Review Comment:
Hey @elharo, sorry for late reply.
So I think `.clone()` works here because in the original version the `pom`
in
[`cleanModel(pom)`](https://github.com/apache/maven-help-plugin/blob/f2c74d68dfb219d43984a3ec76562a9bd4bbc803/src/main/java/org/apache/maven/plugins/help/EffectivePomMojo.java#L182)
has a reference to the original Model, so cleaning/sorting the properties
there overwrites the original ones. That's the issue in #384. Since you
mentioned the goal should be read only, I pass a clone() of the Model to
cleanModel() instead, so only the copy gets changed.
I am still new to this codebase, so if there is a better way I am happy to
change it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]