Skip to content

Unable to call other tasks from test command #2603

Answered by lefou
ex0ns asked this question in Q&A
Discussion options

You must be logged in to vote

The issue with your attempt is, that you don't depend on the result of the super.test() command, but instead return the command itself. Or in other words, you forgot the second ().

 def test(args: String*) = T.command {
       other()
       T.log.info("Running test")
-      super.test()
+      super.test()()
     }

As T.command accepts a Task and you already return a task, you essentially return that super.test task and also access the T.log.info outside of a task, which is not possible. Hence, the somewhat unhelpful error message.

To use a task's outcome, you always add one addition parenthesis pair more than on the definition side.
This is the short for task.apply(). For commands, that…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@lefou
Comment options

@ex0ns
Comment options

Answer selected by ex0ns
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants