Skip to content

Commit 831da06

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 3f0af07 commit 831da06

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
@@ -889,7 +889,10 @@ List<Path> discoverWorkspaceManifests(Path workspaceDir, Set<String> ignorePatte
889889
// Maven multi-module: pom.xml
890890
Path pomXml = workspaceDir.resolve("pom.xml");
891891
if (Files.isRegularFile(pomXml)) {
892-
return discoverMavenModules(workspaceDir, ignorePatterns);
892+
List<Path> mavenManifests = discoverMavenModules(workspaceDir, ignorePatterns);
893+
if (mavenManifests.size() > 1) {
894+
return mavenManifests;
895+
}
893896
}
894897

895898
// JS workspace: require package.json + a lock file
@@ -1121,10 +1124,15 @@ private String resolveMavenBinary(Path startDir) {
11211124
String mvnw =
11221125
JavaMavenProvider.traverseForMvnw(wrapperName, startDir.resolve("pom.xml").toString());
11231126
if (mvnw != null) {
1124-
return mvnw;
1127+
try {
1128+
Operations.runProcess(startDir, mvnw, "-v");
1129+
return mvnw;
1130+
} catch (Exception e) {
1131+
LOG.warning("Maven wrapper found but not accessible: " + e.getMessage());
1132+
}
11251133
}
11261134
}
1127-
return Operations.getCustomPathOrElse(mvn);
1135+
return Operations.getExecutable(mvn, "-v");
11281136
} catch (Exception e) {
11291137
LOG.warning("Failed to resolve Maven binary: " + e.getMessage());
11301138
return null;

0 commit comments

Comments
 (0)