Skip to content

Fix maven spaces dev #546

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

Merged
merged 4 commits into from
May 30, 2025
Merged

Fix maven spaces dev #546

merged 4 commits into from
May 30, 2025

Conversation

agrasth
Copy link
Contributor

@agrasth agrasth commented May 27, 2025

  • All tests passed. If this feature is not already covered by the tests, I added new tests.
  • This pull request is on the dev branch.
  • I used npm run format for formatting the code before submitting the pull request.

🐛 Bug Fix: Handle spaces in Maven POM file paths on Windows agents

Problem

When running a JFrog Maven task on a Windows agent, if the path to the pom.xml file contains spaces (e.g., C:\agent\_work\My Project\pom.xml), the CLI fails with the following error:
ERROR org.apache.maven.cli.MavenCli - Non-readable POM E:

This occurs because the POM file path is not properly quoted, which causes Maven to misinterpret the argument.

Root Cause

The pom.xml file path was passed to the CLI without quotes, resulting in broken CLI commands when the path contains spaces.

Fix

Quote the pom.xml file path using utils.quote() when appending it to the CLI command arguments.

Before:

goalsAndOptions = utils.cliJoin(goalsAndOptions, '-f', pomFile);

After:

goalsAndOptions = utils.cliJoin(goalsAndOptions, '-f', utils.quote(pomFile));

Tests Added

  • Unit Test: spaces_test.js to verify that POM file paths with spaces are properly quoted.

  • Integrated Test Suite: Added under tests.ts to ensure regression coverage.

@agrasth agrasth requested review from bhanurp and fluxxBot May 27, 2025 08:58
@agrasth agrasth merged commit 3661bf6 into jfrog:dev May 30, 2025
2 checks passed
@fluxxBot fluxxBot added the bug Something isn't working label May 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants