mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
EA-49679 - NSE: Thread.run
This commit is contained in:
+1
-1
@@ -36,7 +36,7 @@ public interface MavenServerEmbedder extends Remote {
|
||||
@NotNull Collection<String> activeProfiles) throws RemoteException,
|
||||
MavenServerProcessCanceledException;
|
||||
|
||||
@NotNull
|
||||
@Nullable
|
||||
String evaluateEffectivePom(@NotNull File file, @NotNull List<String> activeProfiles) throws RemoteException,
|
||||
MavenServerProcessCanceledException;
|
||||
|
||||
|
||||
+1
-1
@@ -198,7 +198,7 @@ public class Maven2ServerEmbedderImpl extends MavenRemoteObject implements Maven
|
||||
return result;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nullable
|
||||
public String evaluateEffectivePom(@NotNull File file, @NotNull List<String> activeProfiles) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
+1
-1
@@ -287,7 +287,7 @@ public class Maven3ServerEmbedderImpl extends MavenRemoteObject implements Maven
|
||||
return createExecutionResult(file, result, listener.getRootNode());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nullable
|
||||
@Override
|
||||
public String evaluateEffectivePom(@NotNull File file, @NotNull List<String> activeProfiles)
|
||||
throws RemoteException, MavenServerProcessCanceledException {
|
||||
|
||||
+26
-20
@@ -17,6 +17,7 @@ import org.jdom.input.SAXBuilder;
|
||||
import org.jdom.output.Format;
|
||||
import org.jdom.output.XMLOutputter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -43,38 +44,43 @@ public class MavenEffectivePomDumper {
|
||||
private static final String SETTINGS_XSD_URL = "http://maven.apache.org/xsd/settings-1.0.0.xsd";
|
||||
|
||||
// See org.apache.maven.plugins.help.EffectivePomMojo#execute from maven-help-plugin
|
||||
|
||||
@Nullable
|
||||
public static String evaluateEffectivePom(final Maven3ServerEmbedderImpl embedder,
|
||||
@NotNull final File file,
|
||||
@NotNull List<String> activeProfiles)
|
||||
throws RemoteException, MavenServerProcessCanceledException {
|
||||
|
||||
final MavenExecutionRequest
|
||||
request = embedder.createRequest(file, activeProfiles, Collections.<String>emptyList(), Collections.<String>emptyList());
|
||||
|
||||
final StringWriter w = new StringWriter();
|
||||
|
||||
embedder.executeWithMavenSession(request, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
// copied from DefaultMavenProjectBuilder.buildWithDependencies
|
||||
ProjectBuilder builder = embedder.getComponent(ProjectBuilder.class);
|
||||
ProjectBuildingResult buildingResult = builder.build(new File(file.getPath()), request.getProjectBuildingRequest());
|
||||
try {
|
||||
final MavenExecutionRequest
|
||||
request = embedder.createRequest(file, activeProfiles, Collections.<String>emptyList(), Collections.<String>emptyList());
|
||||
|
||||
MavenProject project = buildingResult.getProject();
|
||||
embedder.executeWithMavenSession(request, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
// copied from DefaultMavenProjectBuilder.buildWithDependencies
|
||||
ProjectBuilder builder = embedder.getComponent(ProjectBuilder.class);
|
||||
ProjectBuildingResult buildingResult = builder.build(new File(file.getPath()), request.getProjectBuildingRequest());
|
||||
|
||||
XMLWriter writer = new PrettyPrintXMLWriter(w, StringUtils.repeat(" ", XmlWriterUtil.DEFAULT_INDENTATION_SIZE));
|
||||
MavenProject project = buildingResult.getProject();
|
||||
|
||||
writeHeader(writer);
|
||||
XMLWriter writer = new PrettyPrintXMLWriter(w, StringUtils.repeat(" ", XmlWriterUtil.DEFAULT_INDENTATION_SIZE));
|
||||
|
||||
writeEffectivePom(project, writer);
|
||||
writeHeader(writer);
|
||||
|
||||
writeEffectivePom(project, writer);
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return w.toString();
|
||||
}
|
||||
|
||||
+4
-1
@@ -66,7 +66,10 @@ public class MavenShowEffectivePom extends AnAction implements DumbAware {
|
||||
if (project.isDisposed()) return;
|
||||
|
||||
if (s == null) { // null means UnsupportedOperationException
|
||||
showUnsupportedNotification(project, file);
|
||||
new Notification(MavenUtil.MAVEN_NOTIFICATION_GROUP,
|
||||
"Error",
|
||||
"Failed to evaluate effective pom.",
|
||||
NotificationType.ERROR).notify(project);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -101,7 +101,7 @@ public abstract class MavenEmbedderWrapper extends RemoteObjectWrapper<MavenServ
|
||||
});
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nullable
|
||||
public String evaluateEffectivePom(@NotNull final VirtualFile file, @NotNull final Collection<String> activeProfiles)
|
||||
throws MavenProcessCanceledException {
|
||||
return perform(new RetriableCancelable<String>() {
|
||||
|
||||
Reference in New Issue
Block a user