Skip to content

Why do we have def mainClass: Target[Option[String]] instead of Target[String]? #2074

Closed Answered by lefou
jk-1 asked this question in Q&A
Discussion options

You must be logged in to vote

I find Mills answer quite clear:

$ mill inspect main.mainClass
[1/1] inspect 
main.mainClass(JavaModule.scala:54)
    Allows you to specify an explicit main class to use for the `run` command.
    If none is specified, the classpath is searched for an appropriate main
    class to use if one exists

Inputs:

Looks like you can't skip the run command by just providing no main class.

How can I implement command like: Run all modules with main and gracefully skip modules without main?

That's currently not possible out of the box.

You could use mill --keep-going _.run and ignore the failed targets, or write your own command to skip when needed.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@jk-1
Comment options

@jk-1
Comment options

Answer selected by jk-1
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants