Package se.kth.depclean.util
Class MavenInvoker
java.lang.Object
se.kth.depclean.util.MavenInvoker
public final class MavenInvoker extends Object
-
Method Summary
Modifier and Type Method Description static intinvokeMaven(String mvnHome, String pomPath, String mvnGoal)This method invokes Maven to execute a given goal programmatically instead of running a command directly as inrunCommand(String).static String[]runCommand(String cmd)Creates a native process to execute a custom command.
-
Method Details
-
runCommand
Creates a native process to execute a custom command. This method is used to invoke maven plugins directly.- Parameters:
cmd- The command to be executed.- Returns:
- The console output.
- Throws:
IOException- In case of IO issues.InterruptedException- In case of IO issues.
-
invokeMaven
public static int invokeMaven(String mvnHome, String pomPath, String mvnGoal) throws org.apache.maven.shared.invoker.MavenInvocationExceptionThis method invokes Maven to execute a given goal programmatically instead of running a command directly as inrunCommand(String).- Parameters:
mvnHome- Location of maven installation.pomPath- Path to the pom of the project.mvnGoal- The maven goal to execute.- Returns:
- The exit code from the Maven invocation.
- Throws:
org.apache.maven.shared.invoker.MavenInvocationException- In case of any issue invoking maven.
-