Skip to content

Commit

Permalink
Improve error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
jjohannes committed Jan 3, 2024
1 parent 0e21763 commit 8df6303
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ public Provider<Dependency> create(String moduleName, SourceSet sourceSetWithMod
return dependency;
} else {
getProject().getLogger().lifecycle(
"[WARN] [Java Module Dependencies] javaModuleDependencies.moduleNameToGA.put(\"" + moduleName + "\", \"group:artifact\") mapping is missing.");
"[WARN] [Java Module Dependencies] " + moduleName + "=group:artifact missing in " + getModulesProperties().get().getAsFile());
return null;
}
});
Expand Down Expand Up @@ -325,6 +325,9 @@ private Map<String, Object> findGav(String ga, String moduleName) {
Optional<VersionConstraint> version = catalog == null ? empty() : catalog.findVersion(moduleName.replace('_', '.'));
Map<String, Object> gav = new HashMap<>();
String[] gaSplit = ga.split(":");
if (gaSplit.length < 2) {
throw new RuntimeException("Invalid mapping: " + moduleName + "="+ ga);
}
gav.put(GAV.GROUP, gaSplit[0]);
gav.put(GAV.ARTIFACT, gaSplit[1]);
version.ifPresent(versionConstraint -> gav.put(GAV.VERSION, versionConstraint));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ class WarningsTest extends Specification {
when:
def result = fail()
then:
result.output.contains('[WARN] [Java Module Dependencies] javaModuleDependencies.moduleNameToGA.put("commons.math3", "group:artifact") mapping is missing.\n')
result.output.contains('[WARN] [Java Module Dependencies] commons.math3=group:artifact missing in')
}
}

0 comments on commit 8df6303

Please sign in to comment.