|
40 | 40 | import org.eclipse.core.runtime.IStatus;
|
41 | 41 | import org.eclipse.core.runtime.MultiStatus;
|
42 | 42 | import org.eclipse.core.runtime.NullProgressMonitor;
|
| 43 | +import org.eclipse.core.runtime.OperationCanceledException; |
43 | 44 | import org.eclipse.core.runtime.Path;
|
44 | 45 | import org.eclipse.jdt.core.IJavaElement;
|
45 | 46 | import org.eclipse.jdt.core.IJavaProject;
|
@@ -147,6 +148,19 @@ public static boolean exportJar(List<Object> arguments, IProgressMonitor monitor
|
147 | 148 | Classpath[] classpaths = gson.fromJson(gson.toJson(arguments.get(1)), Classpath[].class);
|
148 | 149 | String destination = gson.fromJson(gson.toJson(arguments.get(2)), String.class);
|
149 | 150 | String terminalId = gson.fromJson(gson.toJson(arguments.get(3)), String.class);
|
| 151 | + try { |
| 152 | + return exportJarExecution(mainClass, classpaths, destination, terminalId, monitor); |
| 153 | + } catch (OperationCanceledException e) { |
| 154 | + File jarFile = new File(destination); |
| 155 | + if (jarFile.exists()) { |
| 156 | + jarFile.delete(); |
| 157 | + } |
| 158 | + } |
| 159 | + return false; |
| 160 | + } |
| 161 | + |
| 162 | + private static boolean exportJarExecution(String mainClass, Classpath[] classpaths, String destination, |
| 163 | + String terminalId, IProgressMonitor monitor) throws OperationCanceledException { |
150 | 164 | Manifest manifest = new Manifest();
|
151 | 165 | manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
|
152 | 166 | if (mainClass.length() > 0) {
|
|
0 commit comments