// Find if any contribution JARs already available locally on the classpath
Map<String, URL> localContributions = localContributions();
// Load the specified contributions
ContributionService contributionService = runtime.getContributionService();
List<Contribution> contributions = new ArrayList<Contribution>();
for (Contribution contribution : configuration.getContributions()) {
URI uri = createURI(contribution.getLocation());
if (uri.getScheme() == null) {
uri = new File(contribution.getLocation()).toURI();
}
URL contributionURL = uri.toURL();
// Extract contribution file name
String file = contributionURL.getPath();
int i = file.lastIndexOf('/');
if (i != -1 && i < file.length() - 1) {
file = file.substring(i + 1);
// If we find the local contribution file on the classpath, use it in
// place of the original contribution URL
URL localContributionURL = localContributions.get(file);
if (localContributionURL != null) {
contributionURL = localContributionURL;
}
}
// Load the contribution
logger.log(Level.INFO, "Loading contribution: " + contributionURL);
contributions.add(contributionService.contribute(contribution.getURI(), contributionURL, false));
analyseProblems();
}
// Resolve the metadata within the context of the first contribution
Contribution mainContribution = contributions.get(contributions.size() - 1);