// plugin dependencies
final Plugin thisPlugin = (Plugin) project.getBuild().getPluginsAsMap().get("org.apache.openejb:spi-helper-maven-plugin");
if (thisPlugin != null && thisPlugin.getDependencies() != null) {
for (Dependency artifact : thisPlugin.getDependencies()) {
final Artifact resolved = new DefaultArtifact(
artifact.getGroupId(), artifact.getArtifactId(), VersionRange.createFromVersion(artifact.getVersion()),
artifact.getScope(), artifact.getType(), artifact.getClassifier(), new DefaultArtifactHandler());
try {
resolver.resolve(resolved, remotePluginRepositories, local);
urls.add(resolved.getFile().toURI().toURL());
} catch (ArtifactResolutionException e) {
getLog().warn("can't resolve " + artifact.getArtifactId());
} catch (ArtifactNotFoundException e) {
getLog().warn("can't find " + artifact.getArtifactId());
} catch (MalformedURLException e) {
getLog().warn("can't get url of " + resolved.getFile() + " for artifact " + resolved.getArtifactId());
}
}
}
return new URLClassLoader(urls.toArray(new URL[urls.size()]), ClassLoader.getSystemClassLoader());