[MNG-8425] Fix mvnenc init saving invalid master source configuration#12418
Open
Hiteshsai007 wants to merge 1 commit into
Open
[MNG-8425] Fix mvnenc init saving invalid master source configuration#12418Hiteshsai007 wants to merge 1 commit into
Hiteshsai007 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[MNG-8425] Fix mvnenc init saving invalid master source configuration
Fixes #10202
Description
This PR fixes MNG-8425 (#10202) where
mvn --enc initgenerates an invalidsettings-security4.xml, causingmvn --enc encryptto fail with "Maven Encryption is not configured."Root Cause
When the encryption wizard prompts the user to customize an editable value, the template is presented as
env:$VARIABLE_NAME. The user is expected to replace only the$VARIABLE_NAMEportion (e.g., typingMVN_PASSWORD), but theInitgoal saves the raw user input directly — resulting in<value>MVN_PASSWORD</value>instead of the correct<value>env:MVN_PASSWORD</value>.The
MasterDispatcherinplexus-sec-dispatcherthen fails validation because noMasterSourcerecognizes a config string without its required prefix (env:,sys-property:, etc.), producing the error:Configured Source configuration not handled.Fix
In
Init.java, after the user provides their input for an editable field, the code now:$placeholder).This ensures the generated
settings-security4.xmlalways contains well-formed source values likeenv:MVN_PASSWORD.Testing
maven-clipass.mvn --enc initnow writes the correctenv:prefix andmvn --enc encryptsucceeds afterward.Your pull request should address just one issue, without pulling in other changes.
Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
Each commit in the pull request should have a meaningful subject line and body.
Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied.
Run
mvn verifyto make sure basic checks pass.You have run the Core IT successfully.
I hereby declare this contribution to be licenced under the Apache License Version 2.0, January 2004