Skip to content

Commit 580d9b3

Browse files
Strum355claude
andcommitted
fix(workspace): fix Maven binary resolution and glob pattern matching
Use getCustomPathOrElse for Maven binary resolution (matching Gradle), and handle Java PathMatcher quirk where **/X/** doesn't match paths where X is the first component. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 9c82b16 commit 580d9b3

1 file changed

Lines changed: 10 additions & 22 deletions

File tree

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

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ List<Path> discoverWorkspaceManifests(Path workspaceDir, Set<String> ignorePatte
890890
Path pomXml = workspaceDir.resolve("pom.xml");
891891
if (Files.isRegularFile(pomXml)) {
892892
List<Path> mavenManifests = discoverMavenModules(workspaceDir, ignorePatterns);
893-
if (mavenManifests.size() > 1) {
893+
if (!mavenManifests.isEmpty()) {
894894
return mavenManifests;
895895
}
896896
}
@@ -1115,29 +1115,17 @@ static List<String> parseMavenModuleList(String raw) {
11151115
* @param startDir the directory from which to start searching for mvnw
11161116
* @return the resolved Maven binary path, or null if Maven is not available
11171117
*/
1118-
private String resolveMavenBinary(Path startDir) {
1119-
try {
1120-
boolean preferWrapper = Operations.getWrapperPreference("mvn");
1121-
String mvn = Operations.isWindows() ? "mvn.cmd" : "mvn";
1122-
if (preferWrapper) {
1123-
String wrapperName = Operations.isWindows() ? "mvnw.cmd" : "mvnw";
1124-
String mvnw =
1125-
JavaMavenProvider.traverseForMvnw(
1126-
wrapperName, startDir.resolve("pom.xml").toString(), null);
1127-
if (mvnw != null) {
1128-
try {
1129-
Operations.runProcess(startDir, mvnw, "-v");
1130-
return mvnw;
1131-
} catch (Exception e) {
1132-
LOG.warning("Maven wrapper found but not accessible: " + e.getMessage());
1133-
}
1134-
}
1118+
private static String resolveMavenBinary(Path startDir) {
1119+
if (Operations.getWrapperPreference("mvn")) {
1120+
String wrapperName = Operations.isWindows() ? "mvnw.cmd" : "mvnw";
1121+
String wrapper =
1122+
JavaMavenProvider.traverseForMvnw(
1123+
wrapperName, startDir.resolve("pom.xml").toString(), null);
1124+
if (wrapper != null) {
1125+
return wrapper;
11351126
}
1136-
return Operations.getExecutable(mvn, "-v");
1137-
} catch (Exception e) {
1138-
LOG.warning("Failed to resolve Maven binary: " + e.getMessage());
1139-
return null;
11401127
}
1128+
return Operations.getCustomPathOrElse("mvn");
11411129
}
11421130

11431131
/**

0 commit comments

Comments
 (0)