Я хочу запустить мой метод main
с помощью gradle task
Вот как я запускаю через cmd:
java -cp RTMonitor.jar com.bla.MainRunner first_arg
как это должно быть записано в gradle?
run {
args += ['java -cp RTMonitor.jar com.bla.MainRunner first_arg']
}
Обновление
Я пробовал
task myRun(type: JavaExec) {
classpath configurations.main
main = "com.bla.runners.StatsLogGenerator"
args "arg1", "arg2"
}
и я получил:
Error:(71, 0) Could not find property 'main' on configuration container.
the I have tried:
task myRun(type: JavaExec) {
classpath "configurations.main"
main = "com.bla.runners.StatsLogGenerator"
args "arg1", "arg2"
}
и я получил сообщение об ошибке:
FAILURE: Build failed with an exception.
17:49:21.855 [ERROR] [org.gradle.BuildExceptionReporter]
17:49:21.856 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
17:49:21.856 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':myRun'.
17:49:21.856 [ERROR] [org.gradle.BuildExceptionReporter] > Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
17:49:21.864 [ERROR] [org.gradle.BuildExceptionReporter]
17:49:21.865 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is:
17:49:21.866 [ERROR] [org.gradle.BuildExceptionReporter] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':myRun'.
17:49:21.867 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
17:49:21.882 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:361)
17:49:21.882 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.process.internal.DefaultJavaExecAction.execute(DefaultJavaExecAction.java:31)
но когда я запускаю Intellij, каждый тэг работает нормально