SBT how to run InputTask

I create some custom tasks in my SBT project and need to call other tasks for this.

How can I call inputTasks from within my tasks and support them for input?

+6
source share
1 answer

Since you can consider your own tasks, I assume that you are trying to use the run task. It took a little digging, but I finally earned it; in a nutshell, this is what you are doing (assuming your task is called deployTask , set up according to your needs):

 deployTask <<= ( fullClasspath in Compile, runner ) map { ( classpath, runner ) => val logger = ConsoleLogger() // Not sure this is optimal Run.executeTrapExit( { Run.run( "com.sample.MainClass", classpath map { _.data }, Seq( "option1", "option2", "..." ), // <-- Options go here logger )( runner ) }, logger ) } 

This does not directly InputTask (I have not yet found a way to do this), but it at least allows you to run arbitrary Java code.

+5
source

Source: https://habr.com/ru/post/908846/


All Articles