Skip to content

Commit 3810b47

Browse files
Strum355claude
andcommitted
fix(workspace): prevent Maven discovery from blocking fallthrough to other ecosystems
Two fixes: 1. discoverWorkspaceManifests now checks if Maven module discovery found actual submodules (size > 1) before returning. A single-module Maven project (just root pom.xml) falls through to Gradle/Go/uv/JS detection. 2. resolveMavenBinary now verifies the wrapper is accessible (runs it with -v) before returning it, matching selectMvnRuntime behavior. Also uses Operations.getExecutable instead of getCustomPathOrElse to verify the system Maven binary exists. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent b32dc96 commit 3810b47

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

src/main/java/io/github/guacsec/trustifyda/impl/ExhortApi.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,10 @@ List<Path> discoverWorkspaceManifests(Path workspaceDir, Set<String> ignorePatte
880880
// Maven multi-module: pom.xml
881881
Path pomXml = workspaceDir.resolve("pom.xml");
882882
if (Files.isRegularFile(pomXml)) {
883-
return discoverMavenModules(workspaceDir, ignorePatterns);
883+
List<Path> mavenManifests = discoverMavenModules(workspaceDir, ignorePatterns);
884+
if (mavenManifests.size() > 1) {
885+
return mavenManifests;
886+
}
884887
}
885888

886889
// JS workspace: require package.json + a lock file
@@ -1076,10 +1079,15 @@ private String resolveMavenBinary(Path startDir) {
10761079
String mvnw =
10771080
JavaMavenProvider.traverseForMvnw(wrapperName, startDir.resolve("pom.xml").toString());
10781081
if (mvnw != null) {
1079-
return mvnw;
1082+
try {
1083+
Operations.runProcess(startDir, mvnw, "-v");
1084+
return mvnw;
1085+
} catch (Exception e) {
1086+
LOG.warning("Maven wrapper found but not accessible: " + e.getMessage());
1087+
}
10801088
}
10811089
}
1082-
return Operations.getCustomPathOrElse(mvn);
1090+
return Operations.getExecutable(mvn, "-v");
10831091
} catch (Exception e) {
10841092
LOG.warning("Failed to resolve Maven binary: " + e.getMessage());
10851093
return null;

0 commit comments

Comments
 (0)