PluginResolutionResponse (LongRunningTask task, MavenId mavenPluginId, List<Dependency> pluginDependencies, List<RemoteRepository> remoteRepos, RepositorySystemSession session) { long startTime = System.currentTimeMillis(); List<MavenArtifact> artifacts = new ArrayList<>(); if (task.isCanceled()) return new PluginResolutionResponse(mavenPluginId, false, artifacts); try { Plugin plugin = new Plugin(); plugin.setGroupId(mavenPluginId.getGroupId()); plugin.setArtifactId(mavenPluginId.getArtifactId()); plugin.setVersion(mavenPluginId.getVersion()); plugin.setDependencies(pluginDependencies); PluginDependenciesResolver pluginDependenciesResolver = getComponent(PluginDependenciesResolver.class); org.eclipse.aether.artifact.Artifact pluginArtifact = pluginDependenciesResolver.resolve(plugin, remoteRepos, session); DependencyNode node = pluginDependenciesResolver .resolve(plugin, pluginArtifact, null, remoteRepos, session); PreorderNodeListGenerator nlg = new PreorderNodeListGenerator(); node.accept(nlg); for (org.eclipse.aether.artifact.Artifact artifact : nlg.getArtifacts(true)) { if (!Objects.equals(artifact.getArtifactId(), plugin.getArtifactId()) || !Objects.equals(artifact.getGroupId(), plugin.getGroupId())) { artifacts.add(Maven40ModelConverter.convertArtifact(RepositoryUtils.toArtifact(artifact), getLocalRepositoryFile())); } } task.incrementFinishedRequests(); return new PluginResolutionResponse(mavenPluginId, true, artifacts); } catch (Exception e) { MavenServerGlobals.getLogger().warn(e); return new PluginResolutionResponse(mavenPluginId, false, artifacts); } finally { long totalTime = System.currentTimeMillis() - startTime; MavenServerGlobals.getLogger().debug("Resolved plugin " + mavenPluginId + " in " + totalTime + " ms"); } }