Class MavenCommandRunner
java.lang.Object
core.support.annotation.helper.utils.MavenCommandRunner
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcopyURLToFile(URL source, File destination) static voiddownload maven if path is not foundexcuteCommand(String command) run command based on windows or mac/linux environmentstatic voidstatic Stringget current project root directory, where pom.xml isprotected static booleanisMac()returns true if OS is macprotected static booleanisUnix()returns true if OS is unix or linuxprotected static booleanreturns true if OS is windowsstatic voidprocess of setting maven: 1.static voidMaven home: /usr/local/Cellar/maven/3.6.2/libexec get path of maven from "mvn -version"static voidset maven path if set from config filestatic Fileverify maven bin path exists in maven path or parent folder set maven path to the correct value
-
Field Details
-
MAVEN_PATH
-
MAVEN_URL
-
MAVEN_DOWNLOAD_DESTINATION
-
-
Constructor Details
-
MavenCommandRunner
public MavenCommandRunner()
-
-
Method Details
-
main
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 -
downloadMavenIfNotExist
download maven if path is not found -
copyURLToFile
- Throws:
IOException
-
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
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
verify maven bin path exists in maven path or parent folder set maven path to the correct value- Returns:
-
getRootDir
get current project root directory, where pom.xml is- Returns:
-
executeMavenCommandEmbedded
public static void executeMavenCommandEmbedded()
-