IDEA-84847 adding a new plugin in a profile and activating the profile inside Idea does not update known goals of that plugin

This commit is contained in:
Sergey Evdokimov
2012-04-19 15:33:45 +04:00
parent 85c4d731e0
commit 0d7cc22ae6
2 changed files with 38 additions and 12 deletions
@@ -285,19 +285,30 @@ public class Maven2ServerEmbedderImpl extends MavenRemoteObject implements Maven
MavenProject project = RemoteNativeMavenProjectHolder.findProjectById(nativeMavenProjectId);
PluginDescriptor result = getComponent(PluginManager.class).verifyPlugin(mavenPlugin, project,
myImpl.getSettings(), myImpl.getLocalRepository());
if (!transitive) return Collections.emptyList();
// todo try to use parallel downloading
Map<MavenArtifactInfo, MavenArtifact> resolvedArtifacts = new THashMap<MavenArtifactInfo, MavenArtifact>();
for (Artifact each : (Iterable<Artifact>)result.getIntroducedDependencyArtifacts()) {
resolveIfNecessary(new MavenArtifactInfo(each.getGroupId(), each.getArtifactId(), each.getVersion(), each.getType(), null),
repositories, resolvedArtifacts);
}
for (ComponentDependency each : (List<ComponentDependency>)result.getDependencies()) {
resolveIfNecessary(new MavenArtifactInfo(each.getGroupId(), each.getArtifactId(), each.getVersion(), each.getType(), null),
repositories, resolvedArtifacts);
Artifact pluginArtifact = result.getPluginArtifact();
MavenArtifactInfo artifactInfo = new MavenArtifactInfo(pluginArtifact.getGroupId(),
pluginArtifact.getArtifactId(),
pluginArtifact.getVersion(),
pluginArtifact.getType(), null);
resolveIfNecessary(artifactInfo, repositories, resolvedArtifacts);
if (transitive) {
// todo try to use parallel downloading
for (Artifact each : (Iterable<Artifact>)result.getIntroducedDependencyArtifacts()) {
resolveIfNecessary(new MavenArtifactInfo(each.getGroupId(), each.getArtifactId(), each.getVersion(), each.getType(), null),
repositories, resolvedArtifacts);
}
for (ComponentDependency each : (List<ComponentDependency>)result.getDependencies()) {
resolveIfNecessary(new MavenArtifactInfo(each.getGroupId(), each.getArtifactId(), each.getVersion(), each.getType(), null),
repositories, resolvedArtifacts);
}
}
return new THashSet<MavenArtifact>(resolvedArtifacts.values());
}
catch (Exception e) {
@@ -1022,11 +1022,26 @@ public class MavenProjectsTree {
embedder.clearCachesFor(mavenProject.getMavenId());
try {
process.setText(ProjectBundle.message("maven.downloading.pom.plugins", mavenProject.getDisplayName()));
Set<File> filesToRefresh = new HashSet<File>();
for (MavenPlugin each : mavenProject.getDeclaredPlugins()) {
process.checkCanceled();
process.setText(ProjectBundle.message("maven.downloading.pom.plugins", mavenProject.getDisplayName()));
embedder.resolvePlugin(each, mavenProject.getRemoteRepositories(), nativeMavenProject, false);
Collection<MavenArtifact> artifacts = embedder.resolvePlugin(each, mavenProject.getRemoteRepositories(), nativeMavenProject, false);
for (MavenArtifact artifact : artifacts) {
File pluginJar = artifact.getFile();
File pluginDir = pluginJar.getParentFile();
if (pluginDir != null) {
filesToRefresh.add(pluginDir); // Refresh both *.pom and *.jar files.
}
}
}
LocalFileSystem.getInstance().refreshIoFiles(filesToRefresh);
mavenProject.resetCache();
firePluginsResolved(mavenProject);
}