Thanks so much! These builds weren't Tycho based, but doing as you suggested now works with 0.12.1 as well. It looks like the Eclipse JVM didn't load all of the right classes for some reason? Either way, it works launching it in a separate debug JVM.
Also, I have written a bit of code for capturing whether the maven build was a success or failure. Just in case anyone else is interested in doing something similar. It could use some cleaning up, but it is still just in prototype stage for me.
final StringBuffer errors = new StringBuffer();
IDocumentListener listener = new IDocumentListener() {
public void documentChanged(DocumentEvent event) { ; }
public void documentAboutToBeChanged(DocumentEvent event) {
String output = event.getText();
if (output.contains("ERROR")) {
errors.append(output);
}
}
};
ILaunch launch = DebugUITools.buildAndLaunch(configuration, "run", new NullProgressMonitor());
time = System.currentTimeMillis();
IOConsole console = null;
while (!launch.isTerminated()) {
if (console == null) {
ConsolePlugin plugin = ConsolePlugin.getDefault();
IConsoleManager conMan = plugin.getConsoleManager();
IConsole[] existing = conMan.getConsoles();
// TODO - Find a better way to get the maven output console
// Can't use MavenPlugin.getDefault().getConsole(), it is the wrong console.
for (int i = 0; i < existing.length; i++) {
if (existing[i] instanceof IOConsole) {
if (existing[i].getName().contains("java")) {
console = (IOConsole)existing[i];
console.getDocument().addDocumentListener(listener);
}
}
}
}
}
time = System.currentTimeMillis()-time;
if (console != null) {
console.getDocument().removeDocumentListener(listener);
}
if (errors.length() != 0) {
return (BuildSummary) new BuildFailure(project, time, new Throwable("Please see the console log for more information."));
}
return (BuildSummary) new BuildSuccess(project, time);