001package com.ganteater.ae.desktop; 002 003import java.io.IOException; 004 005import javax.swing.JOptionPane; 006 007import org.apache.commons.lang.ArrayUtils; 008import org.apache.commons.lang.StringUtils; 009import org.apache.commons.lang3.exception.ExceptionUtils; 010 011import com.ganteater.ae.ConfigConstants; 012import com.ganteater.ae.RecipeRunner; 013import com.ganteater.ae.TaskCancelingException; 014import com.ganteater.ae.desktop.ui.AEFrame; 015import com.ganteater.ae.desktop.ui.OptionPane; 016import com.ganteater.ae.util.AEUtils; 017 018/** 019 * Viktor_Tovstyi Date: Sep 7, 2006 Time: 10:24:58 AM 020 */ 021public class Anteater { 022 023 public static void main(final String... args) throws IOException { 024 025 System.out.println( 026 "Starting Anteater Desktop Application - Version: " + AEUtils.getPrjProperty("application.version")); 027 028 if (args.length > 0 && "/console".equalsIgnoreCase(args[0])) { 029 String[] argStr = (String[]) ArrayUtils.subarray(args, 1, args.length); 030 RecipeRunner.main(argStr); 031 032 } else { 033 AEFrame frame = new AEFrame(); 034 try { 035 System.setProperty(ConfigConstants.RECIPES_PARAM_NAME, StringUtils.join(args, ",")); 036 frame.start(); 037 for (String taskFileName : args) { 038 frame.runTask(taskFileName); 039 } 040 } catch (TaskCancelingException e) { 041 System.out.println("Task canceled by user."); 042 System.exit(0); 043 044 } catch (Exception e) { 045 e.printStackTrace(); 046 frame.setAlwaysOnTop(true); 047 048 String rootCauseMessage = ExceptionUtils.getRootCauseMessage(e); 049 if (StringUtils.containsIgnoreCase(rootCauseMessage, "Maven")) { 050 OptionPane.showMessageDialog(frame, "<html><body><b>Maven configuration issue detected:</b><br/><br/>" 051 + rootCauseMessage + "<br/><br/>" 052 + "This is a Maven project. Please ensure that Maven is properly installed and configured. For installation instructions, " 053 + "visit <a href=\"https://maven.apache.org/install.html\">Maven Installation Guide</a>. Additionally, verify your Maven setup" 054 + " by running the command <code>mvn -version</code> to confirm it is correctly installed.<br/><br/>" 055 + "For more information about configuring Anteater with Maven, please refer to the <a href=\"https://ganteater.com/ae-maven-plugin/index.html\">" 056 + "Anteater Maven Plugin Documentation</a>." 057 + "</body></html>", 058 "Configuration Error", JOptionPane.ERROR_MESSAGE); 059 } else { 060 OptionPane.showMessageDialog(frame, rootCauseMessage, "Unexpected Error", 061 JOptionPane.ERROR_MESSAGE); 062 } 063 System.exit(1); 064 } 065 } 066 } 067 068}