-
Notifications
You must be signed in to change notification settings - Fork 523
fix(maven-plugin): escape userProperties using double quotes #1096
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Hi @xloouis, welcome to SOFAStack community, Please sign Contributor License Agreement! After you signed CLA, we will automatically sync the status of this pull request in 3 minutes. |
WalkthroughThe plugin’s RepackageMojo now wraps Maven user property values in double quotes when constructing the dependency:tree command, ensuring values with spaces or special characters are preserved. No other logic or control flow was modified. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant U as User/IDEA
participant Mojo as RepackageMojo
participant MVN as Maven CLI (dependency:tree)
U->>Mojo: Execute repackage
Mojo->>Mojo: Collect userProperties
Note right of Mojo: Format args as -Dkey="value"
Mojo->>MVN: Run dependency:tree with quoted properties
MVN-->>Mojo: Output dependency tree
Mojo-->>U: Continue packaging flow
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
sofa-ark-parent/support/ark-maven-plugin/src/main/java/com/alipay/sofa/ark/boot/mojo/RepackageMojo.java (1)
471-516
: Add unit tests and verify cross-platform quoting.
- Add a test in RepackageMojoTest covering
doGetAllArtifactByMavenTree
withuserProperties
values containing spaces, asserting the generated goals include properly quoted-Dkey="value with spaces"
.- Manually verify the logged Maven command on macOS, Windows, and Linux to ensure correct quoting.
🧹 Nitpick comments (1)
sofa-ark-parent/support/ark-maven-plugin/src/main/java/com/alipay/sofa/ark/boot/mojo/RepackageMojo.java (1)
487-487
: Fix addresses the reported issue with spaces in property values.Wrapping user property values in double quotes correctly prevents Maven from misinterpreting spaces as argument separators, which resolves issue #1095 where IDEA's
maven.ext.class.path
property caused failures.Optional enhancement: Handle values containing double quotes.
If a property value contains embedded double quotes (rare but possible), the resulting argument would be malformed. Consider escaping quotes within values:
- goals.add(String.format("-D%s=%s", key, "\"" + value + "\"")); + goals.add(String.format("-D%s=\"%s\"", key, value.toString().replace("\"", "\\\"")));Alternatively, verify that the Maven Invoker API handles quote escaping automatically when constructing the command line.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
sofa-ark-parent/support/ark-maven-plugin/src/main/java/com/alipay/sofa/ark/boot/mojo/RepackageMojo.java
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: sca
CLA 已经签署, 但好像没有刷新 |
Motivation
Fix sofa-ark-maven-plugin repackage blank space handling
Result
Resolved or fixed #1095
Summary by CodeRabbit