[ https://issues.apache.org/jira/browse/MNG-8425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17904900#comment-17904900 ]
James Nord edited comment on MNG-8425 at 12/11/24 7:32 PM: ----------------------------------------------------------- it appears as though this is because the encrytor wants you to enter "enc:$" before the environment variable name (e.g. {{{}enc:$MAVEN_PASSWORD{}}}) , but this is poor UX, I have already been asked where I want to source it so as a user I expect it to be sourced from the environment, and if maven internals need that to have "env:$" prefixed to the entry then the internals add that not the user. Same occurs for all types. was (Author: jnord_cbs): it appears as though this is because the encrytor wants you to enter "enc:$" before the environment variable name (e.g. {{{}enc:$MAVEN_PASSWORD{}}}) , but this is poor UX, I have already been asked where I want to source it so as a user I expect it to be sourced from the environment, and if maven internals need that to have "env:$" prefixed to the entry then the internals add that not the user. > creating maven encryption settings creates invalid settings > ----------------------------------------------------------- > > Key: MNG-8425 > URL: https://issues.apache.org/jira/browse/MNG-8425 > Project: Maven > Issue Type: Bug > Affects Versions: 4.0.0-rc-1 > Environment: Apache Maven 4.0.0-rc-1 > (d81b1b6a2870dc954d6d642500ad38e8e4cb3dde) > Maven home: C:\Java\maven-4.0.0-rc-1 > Java version: 17.0.9, vendor: Eclipse Adoptium, runtime: > c:\java\jdk-17.0.9.9-hotspot > Default locale: en_GB, platform encoding: Cp1252 > OS name: "windows 11", version: "10.0", arch: "amd64", family: "windows" > Reporter: James Nord > Priority: Blocker > > I ran through the wizard to create a new maven4 encryption setup and then > tried to encrypt a password. > the password encryption failed telling me > "Maven Encryption is not configured, run `mvnenc init` first." > > h3. Steps to reproduce > Create a maven 4 encryption context to use an environment variable: > * Start the Maven 4 encryption wizard to setup encryption ({{{}mvn --force > --enc init{}}}) > * Choose "Master Password Dispatcher" > * Choose "Environment variable (variable name should be edited)" > * Choose "AES/GCM/NoPadding" > * when promped for the variable enter "{{{}MVN_PASSWORD{}}}" > * check the proposed values look correct and approve with "Y" > * wait for the file to be written > Set the variable for maven to use > * {{SET MVN_PASSWORD=TESTING_PASSWORD}} (or use export on *nix like system) > Attempt to create an encrypted password > * {{ mvn --enc encrypt}} > h3. Expected results > * there is a prompt for the password that is to be encrytped > * an encrypted password is output > h3. Actual results > The command tells you encryption is not configured. > > {code:java} > mvn --enc encrypt > Configuration validation of MavenSecDispatcher: INVALID > Configuration file present on path C:\Users\jnord\.m2\settings-security4.xml > Default dispatcher configured > Legacy dispatcher present in system > Legacy dispatcher is operational; transparent fallback possible > Configured default dispatcher configuration is invalid > Configuration validation of MasterDispatcher: INVALID > Configured Cipher supported > Configured Source configuration not handled > Configuration validation of LegacyDispatcher: VALID > Legacy configuration found with encrypted master password > Legacy master password successfully decrypted > Maven Encryption is not configured, run `mvnenc init` first. {code} > > -- This message was sent by Atlassian Jira (v8.20.10#820010)