Class MavenCommandRunner


  • public class MavenCommandRunner
    extends Object
    • Field Detail

      • MAVEN_PATH

        public static String MAVEN_PATH
      • MAVEN_URL

        public static String MAVEN_URL
      • MAVEN_DOWNLOAD_DESTINATION

        public static String MAVEN_DOWNLOAD_DESTINATION
    • Constructor Detail

      • MavenCommandRunner

        public MavenCommandRunner()
    • Method Detail

      • main

        public static void main​(String[] args)
                         throws Exception
        process of setting maven: 1. set maven path from config, if exists 2. use mvn -version shell command to get maven path 3. if not available, download maven into runner/utils/maven folder 4. run maven through maven invoker 5. if maven invoker failed, run using shell command "mvn command"
        Parameters:
        args -
        Throws:
        Exception
      • setMavenPathFromConfig

        public static void setMavenPathFromConfig()
        set maven path if set from config file
      • setMavenPath

        public static void setMavenPath()
        Maven home: /usr/local/Cellar/maven/3.6.2/libexec get path of maven from "mvn -version"
        Parameters:
        results -
      • excuteCommand

        protected static ArrayList<String> excuteCommand​(String command)
        run command based on windows or mac/linux environment
        Parameters:
        command -
        Returns:
      • isMac

        protected static boolean isMac()
        returns true if OS is mac
        Returns:
      • isWindows

        protected static boolean isWindows()
        returns true if OS is windows
        Returns:
      • isUnix

        protected static boolean isUnix()
        returns true if OS is unix or linux
        Returns:
      • verifyAndGetMavenHomePath

        public static File verifyAndGetMavenHomePath()
        verify maven bin path exists in maven path or parent folder set maven path to the correct value
        Returns:
      • getRootDir

        public static String getRootDir()
        get current project root directory, where pom.xml is
        Returns:
      • executeMavenCommandEmbedded

        public static void executeMavenCommandEmbedded()