Repository navigation
fix(maven): accept list output in module discovery - #699
Merged
Merged
Conversation
Maven Help Plugin 3.6.0 emits <list> for project.modules where older versions emit <strings>. Accept both formats so workspace discovery continues to include child modules. Signed-off-by: Adva Oren <aoren@redhat.com>
Reviewer's GuideImplementationAccept Maven Help Plugin output wrapped in either or so module discovery handles both formats.
TestsAdd regression coverage for both wrappers, including empty output, nested aggregators, exclusions, and mocked Maven execution.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/providers/java_maven.js" line_range="576" />
<code_context>
const parser = new XMLParser()
const parsed = parser.parse(raw)
- const entries = parsed?.strings?.string
+ const entries = parsed?.strings?.string ?? parsed?.list?.string
if (!entries) { return [] }
const list = Array.isArray(entries) ? entries : [entries]
</code_context>
<issue_to_address>
**Module paths execute shell commands**
When a Windows user scans an untrusted Maven workspace whose `<list>` output names an existing module directory containing shell metacharacters, `collectMavenModules` resolves the module path and passes its POM to `listMavenModules`; on Windows, `invokeCommand` enables `shell: true` and `handleSpacesInPath` quotes only paths containing spaces, so an ampersand in the path is interpreted as a command separator and runs a command as the scanner user.
Avoid invoking Maven through a shell, or correctly quote/escape every argument passed through the Windows shell.
</issue_to_address>
### Comment 2
<location path="src/providers/java_maven.js" line_range="576" />
<code_context>
const parser = new XMLParser()
const parsed = parser.parse(raw)
- const entries = parsed?.strings?.string
+ const entries = parsed?.strings?.string ?? parsed?.list?.string
if (!entries) { return [] }
const list = Array.isArray(entries) ? entries : [entries]
</code_context>
<issue_to_address>
**Numeric module paths are skipped**
When maven returns a `<list>` containing a valid module path such as `0`, `XMLParser` converts a `<string>0</string>` entry to numeric `0`, so the existing falsy check in `parseMavenModuleList` returns no modules and discovery omits that child POM.
Check for `null` or `undefined` rather than general falsiness before normalizing the entries.
</issue_to_address>Sourcery assessment
Approval pending. 2 findings to address first.
Blocking findings: src/providers/java_maven.js:576, src/providers/java_maven.js:576
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #699 +/- ##
=======================================
Coverage 91.60% 91.60%
=======================================
Files 44 44
Lines 11638 11638
Branches 2346 2347 +1
=======================================
Hits 10661 10661
Misses 977 977
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Strum355
approved these changes
Nov 18, 2026
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.
Description
Restore Maven multi-module discovery when Maven Help Plugin 3.6.0 returns
project.modulesusing a<list>wrapper instead of the older<strings>wrapper. The existing parser accepted only<strings>, silently leaving child modules undiscovered with the newer output.Related issues (if any): None linked.
Checklist
Additional information
Verification
TRUSTIFY_DA_MVN_PATH=/nonexistent/mvn, confirming test isolation.<strings>and<list>output.npm run compile: passes.npm run lint: exits 0; 15 warnings in unchanged files.git diff --check: passes.Existing full-suite failures
npm test: 1,058 passing, 1 pending, 18 failing in this environment. The same 18 failure names were reproduced by running the four affected test files on unchanged baseline commitce9658d:These baseline failures are outside the Maven discovery change and are left untouched. The full local suite is therefore not green.
Summary by Sourcery
Support Maven Help Plugin module-list output across both XML wrapper formats while preserving existing discovery behavior.
Bug Fixes:
<strings>and newer<list>module output formats.Tests: