private static Map<File, File> getJarsToBuildDirs(ModelLoadResult buildInfo) {
Map<File, Lookup> allProjects = buildInfo.getEvaluatedProjectsModel();
Map<File, File> result = CollectionUtils.newHashMap(allProjects.size());
for (Lookup projectInfo: allProjects.values()) {
JarOutputsModel jarsModel = projectInfo.lookup(JarOutputsModel.class);
if (jarsModel != null) {
JavaSourcesModel sources = projectInfo.lookup(JavaSourcesModel.class);
if (sources == null) {
GenericProjectProperties properties = projectInfo.lookup(GenericProjectProperties.class);
String projectName = properties != null
? properties.getProjectFullName()
: "???";
LOGGER.log(Level.WARNING, "No sources for Java project: {0}", projectName);
continue;
}
for (JarOutput jar: jarsModel.getJars()) {
File buildDir = tryGetBuildDirSourceForJar(jar, sources);
if (buildDir != null) {
result.put(jar.getJar(), buildDir);
}
}