DependencyNode root =
pluginDependenciesResolver.resolve( plugin, RepositoryUtils.toArtifact( pluginArtifact ), dependencyFilter,
project.getRemotePluginRepositories(), session.getRepositorySession() );
PreorderNodeListGenerator nlg = new PreorderNodeListGenerator();
root.accept( nlg );
List<Artifact> exposedPluginArtifacts = new ArrayList<Artifact>( nlg.getNodes().size() );
RepositoryUtils.toArtifacts( exposedPluginArtifacts, Collections.singleton( root ),
Collections.<String> emptyList(), null );
for ( Iterator<Artifact> it = exposedPluginArtifacts.iterator(); it.hasNext(); )
{
Artifact artifact = it.next();
if ( artifact.getFile() == null )
{
it.remove();
}
}
List<org.eclipse.aether.artifact.Artifact> pluginArtifacts = nlg.getArtifacts( true );
ClassRealm pluginRealm =
classRealmManager.createPluginRealm( plugin, parent, null, foreignImports, pluginArtifacts );
pluginDescriptor.setClassRealm( pluginRealm );