for (PluginJar piJar : pluginJars) {
final PluginDescriptor descr = piJar.getDescriptor();
final PluginPrerequisite[] prereqs = descr.getPrerequisites();
for (int j = 0; j < prereqs.length; j++) {
PluginPrerequisite required = prereqs[j];
List<String> versions = idToVersions.get(required.getPluginReference().getId());
boolean versionSpecified = (required.getPluginReference().getVersion() == null);
boolean satisfied = false;
if (versions != null) {
satisfied = !versionSpecified ||
versions.contains(required.getPluginReference().getVersion());
}
if (!satisfied) {
String reqVersionStr = versionSpecified ? "" : " version " +
required.getPluginReference().getVersion();
String versionStr = (descr.getVersion() == null) ? "" : " version " +
descr.getVersion();
throw new BuildException("Cannot find plugin "
+ required.getPluginReference().getId() + reqVersionStr
+ ", which is required by " + descr.getId()
+ versionStr);
}
}
}