0

I'm new to java and wants to run maven command with attributes from java code. How can I achieve this?

Here is command that is executing from script file.

$MVN test -Dtest=$SCRIPT_PATH -Dcapability.app=$APP_FILE_PATH -Dmaven.test.failure.ignore=true >> $LOGFILE_PATH;

I want to execute this same thing from java code.

please help me if any one knows.

Thanks in advance

Narendra Sorathiya
  • 3,770
  • 2
  • 34
  • 37

1 Answers1

1

What is the purpose you're trying to achieve?

Anyway, you may use the Runtime library for this:

Process process = Runtime.getRuntime().exec("mvn clean install -DmyAwsomeProperty=awsome");
process.waitFor();
vegaasen
  • 1,022
  • 7
  • 16
  • I want to execute this command from java. $MVN test -Dtest=$SCRIPT_PATH -Dcapability.app=$APP_FILE_PATH -Dmaven.test.failure.ignore=true >> $LOGFILE_PATH; – Narendra Sorathiya Dec 07 '16 at 12:37