print jar process errors if building archive fails
This commit is contained in:
parent
f057939595
commit
feb0db0b3e
|
@ -24,7 +24,7 @@
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: ExecuteJAR.java,v 1.3 2010/03/10 13:09:05 fros4943 Exp $
|
* $Id: ExecuteJAR.java,v 1.4 2010/03/10 14:17:36 fros4943 Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package se.sics.cooja.util;
|
package se.sics.cooja.util;
|
||||||
|
@ -51,6 +51,9 @@ import se.sics.cooja.MoteType;
|
||||||
import se.sics.cooja.Plugin;
|
import se.sics.cooja.Plugin;
|
||||||
import se.sics.cooja.ProjectConfig;
|
import se.sics.cooja.ProjectConfig;
|
||||||
import se.sics.cooja.Simulation;
|
import se.sics.cooja.Simulation;
|
||||||
|
import se.sics.cooja.dialogs.CompileContiki;
|
||||||
|
import se.sics.cooja.dialogs.MessageList;
|
||||||
|
import se.sics.cooja.dialogs.MessageList.MessageContainer;
|
||||||
import se.sics.cooja.plugins.ScriptRunner;
|
import se.sics.cooja.plugins.ScriptRunner;
|
||||||
|
|
||||||
public class ExecuteJAR {
|
public class ExecuteJAR {
|
||||||
|
@ -102,7 +105,10 @@ public class ExecuteJAR {
|
||||||
}
|
}
|
||||||
s.stopSimulation();
|
s.stopSimulation();
|
||||||
|
|
||||||
buildExecutableJAR(s.getGUI(), new File(config.getName() + ".jar"));
|
try {
|
||||||
|
buildExecutableJAR(s.getGUI(), new File(config.getName() + ".jar"));
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
}
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,18 +443,29 @@ public class ExecuteJAR {
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info("Building executable JAR: " + outputFile);
|
logger.info("Building executable JAR: " + outputFile);
|
||||||
|
MessageList errors = new MessageList();
|
||||||
try {
|
try {
|
||||||
Process jarProcess = Runtime.getRuntime().exec(
|
CompileContiki.compile(
|
||||||
new String[] { "jar", "cfm", outputFile.getAbsolutePath(), "manifest.tmp", "*"},
|
"jar cfm " + outputFile.getAbsolutePath() + " manifest.tmp *",
|
||||||
null,
|
null,
|
||||||
workingDir
|
outputFile,
|
||||||
|
workingDir,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
errors,
|
||||||
|
true
|
||||||
);
|
);
|
||||||
jarProcess.waitFor();
|
} catch (Exception e) {
|
||||||
} catch (Exception e1) {
|
logger.warn("Building executable JAR error: " + e.getMessage());
|
||||||
throw (RuntimeException) new RuntimeException(
|
MessageContainer[] err = errors.getMessages();
|
||||||
"Error when building executable JAR: " + e1.getMessage()
|
for (int i=0; i < err.length; i++) {
|
||||||
).initCause(e1);
|
logger.fatal(">> " + err[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Forward exception */
|
||||||
|
throw (RuntimeException)
|
||||||
|
new RuntimeException("Error when building executable JAR: " + e.getMessage()).initCause(e);
|
||||||
|
}
|
||||||
|
|
||||||
/* Delete temporary working directory */
|
/* Delete temporary working directory */
|
||||||
logger.info("Deleting temporary files in: " + workingDir.getAbsolutePath());
|
logger.info("Deleting temporary files in: " + workingDir.getAbsolutePath());
|
||||||
|
|
Loading…
Reference in a new issue