NCLSUP-1478 Add a suppressManifestComment option - #1186
Conversation
…he printing of the footer manifest comment "Modified by POM Manipulation Extension for Maven"
| this.handler = handler; | ||
| parsePomTemplates = Boolean.parseBoolean( | ||
| handler.getUserProperties().getProperty(PARSE_POM_TEMPLATES, "true")); | ||
| } |
There was a problem hiding this comment.
Instead of storing the handler, why not just store a boolean like the parsePomTemplates ?
There was a problem hiding this comment.
@rnc It doesn't seem to work for me with just the boolean and I am not sure that parsePomTemplates works - I'm trying to verify locally
java -jar /Users/tcunning/src/community/pom-manipulation-ext/cli/target/pom-manipulation-cli-5.6-SNAPSHOT.jar -f /tmp/pme-test/pom.xml -DversionSuffix=redhat-1 -DsuppressManifestComment=true
Without the maven handler, I'm still seeing manifest comments.
Here's what Claude is telling me about that
PomIO is looked up (and constructed) at line 355, before the MavenSession with user properties is set on ManipulationSession at line 402. At construction time, ManipulationSession.mavenSession is null, so getUserProperties() returns an empty Properties — and suppressManifestComment defaults to false.
This is why the original code stored the handler reference and read the property lazily in write() — by that point the session is fully initialized. The parsePomTemplates property has the same bug but nobody notices because its default (true) is the normal desired behavior.
There was a problem hiding this comment.
@cunningt Huh, good spot! Bob agrees with you - the creation in the Cli code versus the instantiation of the session later on. And the same applies when its running as an extension for that matter.
parsePomTemplates was added a long time ago and at some point I meant to remove it. Its an undocumented flag that was intended to be removed 4 years ago - feel free to remove it now if it would simplify the code.
|
@cunningt Can you also add a PR to the gh-pages branch to document this please? |
Mend Scan ResultsStatus: SCA scan outputSAST scan output |
NCLSUP-1478 Add a suppressManifestComment option that will suppress the printing of the footer manifest comment "Modified by POM Manipulation Extension for Maven".
Example