com-lihaoyi / mill

Mill is a fast JVM build tool that supports Java and Scala. 2-4x faster than Gradle and 4-10x faster than Maven for common workflows, Mill aims to make your project’s build process performant, maintainable, and flexible
https://mill-build.org/
MIT License
2.22k stars 356 forks source link

Provide a better default error message when running `$ ./mill` #3547

Closed lihaoyi closed 2 months ago

lihaoyi commented 2 months ago

Currently it just shows the following, which is most unhelpful:

$ ./mill
A target must be provided.

We should be able to do better, and provide a "mini tutorial" customized to the particular build. Some ideas:

Gradle and Maven does a decent job here, even if imperfect. We should be able to do something better in Mill as well

lihaoyi commented 2 months ago

For reference this is Gradle's default message

lihaoyi mockito$ ./gradlew

> Configure project :
Building version '5.12.1-SNAPSHOT'
  - reason: shipkit-auto-version deduced snapshot based on tag: 'v5.12.0'

> Task :help

Welcome to Gradle 8.5.

To run a build, run gradlew <task> ...

To see a list of available tasks, run gradlew tasks

To see more detail about a task, run gradlew help --task <task>

To see a list of command-line options, run gradlew --help

For more detail on using Gradle, see https://docs.gradle.org/8.5/userguide/command_line_interface.html

For troubleshooting, visit https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.5/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD SUCCESSFUL in 812ms
1 actionable task: 1 executed
WARNING: The following functionality has been deprecated and will be removed in the next major release of the Develocity Gradle plugin. Run with '-Ddevelocity.deprecation.captureOrigin=true' to see where the deprecated functionality is being used. For assistance with migration, see https://gradle.com/help/gradle-plugin-develocity-migration.
- The deprecated "gradleEnterprise.buildScan.termsOfServiceUrl" API has been replaced by "develocity.buildScan.termsOfUseUrl"
- The deprecated "gradleEnterprise.buildScan.termsOfServiceAgree" API has been replaced by "develocity.buildScan.termsOfUseAgree"
- The "com.gradle.enterprise" plugin has been replaced by "com.gradle.develocity"

And this is Maven's default message

lihaoyi netty$ ./mvnw
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Detecting the operating system and CPU architecture
[INFO] ------------------------------------------------------------------------
[INFO] os.detected.name: osx
[INFO] os.detected.arch: aarch_64
[INFO] os.detected.bitness: 64
[INFO] os.detected.version: 14.2
[INFO] os.detected.version.major: 14
[INFO] os.detected.version.minor: 2
[INFO] os.detected.classifier: osx-aarch_64
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] Netty/Dev-Tools                                                    [jar]
[INFO] Netty                                                              [pom]
[INFO] Netty/Common                                                       [jar]
[INFO] Netty/Buffer                                                       [jar]
[INFO] Netty/Resolver                                                     [jar]
[INFO] Netty/Transport                                                    [jar]
[INFO] Netty/Codec                                                        [jar]
[INFO] Netty/Codec/DNS                                                    [jar]
[INFO] Netty/Codec/HAProxy                                                [jar]
[INFO] Netty/Transport/Native/Unix/Common                                 [jar]
[INFO] Netty/Handler                                                      [jar]
[INFO] Netty/Codec/HTTP                                                   [jar]
[INFO] Netty/Codec/HTTP2                                                  [jar]
[INFO] Netty/Codec/Memcache                                               [jar]
[INFO] Netty/Codec/MQTT                                                   [jar]
[INFO] Netty/Codec/Redis                                                  [jar]
[INFO] Netty/Codec/SMTP                                                   [jar]
[INFO] Netty/Codec/Socks                                                  [jar]
[INFO] Netty/Codec/Stomp                                                  [jar]
[INFO] Netty/Codec/XML                                                    [jar]
[INFO] Netty/Handler/Proxy                                                [jar]
[INFO] Netty/Resolver/DNS                                                 [jar]
[INFO] Netty/Handler/Ssl/Ocsp                                             [jar]
[INFO] Netty/Transport/RXTX                                               [jar]
[INFO] Netty/Transport/SCTP                                               [jar]
[INFO] Netty/Transport/UDT                                                [jar]
[INFO] Netty/Transport/Classes/Epoll                                      [jar]
[INFO] Netty/Transport/Classes/KQueue                                     [jar]
[INFO] Netty/Resolver/DNS/Classes/MacOS                                   [jar]
[INFO] Netty/All-in-One                                                   [jar]
[INFO] Netty/Resolver/DNS/Native/MacOS                                    [jar]
[INFO] Netty/Transport/Native/Unix/Common/Tests                           [jar]
[INFO] Netty/Testsuite                                                    [jar]
[INFO] Netty/Transport/Native/Epoll                                       [jar]
[INFO] Netty/Transport/Native/KQueue                                      [jar]
[INFO] Netty/Example                                                      [jar]
[INFO] Netty/Testsuite/Autobahn                                           [jar]
[INFO] Netty/Testsuite/Http2                                              [jar]
[INFO] Netty/Testsuite/OSGI                                               [jar]
[INFO] Netty/Testsuite/Shading                                            [jar]
[INFO] Netty/Testsuite/Native                                             [jar]
[INFO] Netty/Testsuite/NativeImage                                        [jar]
[INFO] Netty/Testsuite/NativeImage/Client                                 [jar]
[INFO] Netty/Testsuite/NativeImage/ClientRuntimeInit                      [jar]
[INFO] Netty/Transport/BlockHound/Tests                                   [jar]
[INFO] Netty/Microbench                                                   [jar]
[INFO] Netty/BOM                                                          [pom]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Netty 4.1.113.Final-SNAPSHOT:
[INFO]
[INFO] Netty/Dev-Tools .................................... SKIPPED
[INFO] Netty .............................................. SKIPPED
[INFO] Netty/Common ....................................... SKIPPED
[INFO] Netty/Buffer ....................................... SKIPPED
[INFO] Netty/Resolver ..................................... SKIPPED
[INFO] Netty/Transport .................................... SKIPPED
[INFO] Netty/Codec ........................................ SKIPPED
[INFO] Netty/Codec/DNS .................................... SKIPPED
[INFO] Netty/Codec/HAProxy ................................ SKIPPED
[INFO] Netty/Transport/Native/Unix/Common ................. SKIPPED
[INFO] Netty/Handler ...................................... SKIPPED
[INFO] Netty/Codec/HTTP ................................... SKIPPED
[INFO] Netty/Codec/HTTP2 .................................. SKIPPED
[INFO] Netty/Codec/Memcache ............................... SKIPPED
[INFO] Netty/Codec/MQTT ................................... SKIPPED
[INFO] Netty/Codec/Redis .................................. SKIPPED
[INFO] Netty/Codec/SMTP ................................... SKIPPED
[INFO] Netty/Codec/Socks .................................. SKIPPED
[INFO] Netty/Codec/Stomp .................................. SKIPPED
[INFO] Netty/Codec/XML .................................... SKIPPED
[INFO] Netty/Handler/Proxy ................................ SKIPPED
[INFO] Netty/Resolver/DNS ................................. SKIPPED
[INFO] Netty/Handler/Ssl/Ocsp ............................. SKIPPED
[INFO] Netty/Transport/RXTX ............................... SKIPPED
[INFO] Netty/Transport/SCTP ............................... SKIPPED
[INFO] Netty/Transport/UDT ................................ SKIPPED
[INFO] Netty/Transport/Classes/Epoll ...................... SKIPPED
[INFO] Netty/Transport/Classes/KQueue ..................... SKIPPED
[INFO] Netty/Resolver/DNS/Classes/MacOS ................... SKIPPED
[INFO] Netty/All-in-One ................................... SKIPPED
[INFO] Netty/Resolver/DNS/Native/MacOS .................... SKIPPED
[INFO] Netty/Transport/Native/Unix/Common/Tests ........... SKIPPED
[INFO] Netty/Testsuite .................................... SKIPPED
[INFO] Netty/Transport/Native/Epoll ....................... SKIPPED
[INFO] Netty/Transport/Native/KQueue ...................... SKIPPED
[INFO] Netty/Example ...................................... SKIPPED
[INFO] Netty/Testsuite/Autobahn ........................... SKIPPED
[INFO] Netty/Testsuite/Http2 .............................. SKIPPED
[INFO] Netty/Testsuite/OSGI ............................... SKIPPED
[INFO] Netty/Testsuite/Shading ............................ SKIPPED
[INFO] Netty/Testsuite/Native ............................. SKIPPED
[INFO] Netty/Testsuite/NativeImage ........................ SKIPPED
[INFO] Netty/Testsuite/NativeImage/Client ................. SKIPPED
[INFO] Netty/Testsuite/NativeImage/ClientRuntimeInit ...... SKIPPED
[INFO] Netty/Transport/BlockHound/Tests ................... SKIPPED
[INFO] Netty/Microbench ................................... SKIPPED
[INFO] Netty/BOM .......................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.361 s
[INFO] Finished at: 2024-09-16T10:11:01+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: pre-clean, clean, post-clean, validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-site, site, post-site, site-deploy. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoGoalSpecifiedException

SBT launches into the shell when run without arguments, but help brings up

lihaoyi gatling$ sbt
[info] welcome to sbt 1.10.1 (Amazon.com Inc. Java 17.0.6)
[info] loading settings for project gatling-build from plugins.sbt ...
[info] loading project definition from /Users/lihaoyi/Github/gatling/project
[info] compiling 4 Scala sources to /Users/lihaoyi/Github/gatling/project/target/scala-2.12/sbt-1.0/classes ...
[info] loading settings for project gatling-parent from build.sbt ...
[info] resolving key references (19706 settings) ...
[info] set current project to gatling-parent (in build file:/Users/lihaoyi/Github/gatling/)
[info] sbt server started at local:///Users/lihaoyi/.sbt/1.0/server/b591b075c99bca1531bf/sock
[info] started sbt server
sbt:gatling-parent> help

  <command> (; <command>)*                       Runs the provided semicolon-separated commands.
  about                                          Displays basic information about sbt and the build.
  tasks                                          Lists the tasks defined for the current project.
  settings                                       Lists the settings defined for the current project.
  reload                                         (Re)loads the current project or changes to plugins project or returns from it.
  new                                            Creates a new sbt build.
  new                                            Creates a new sbt build.
  projects                                       Lists the names of available projects or temporarily adds/removes extra builds to the session.
  project                                        Displays the current project or changes to the provided `project`.
  set [every] <setting>                          Evaluates a Setting and applies it to the current project.
  session                                        Manipulates session settings.  For details, run 'help session'.
  inspect [tree|uses|definitions|actual] <key>   Prints the value for 'key', the defining scope, delegates, related definitions, and dependencies.
  <log-level>                                    Sets the logging level to 'log-level'.  Valid levels: debug, info, warn, error
  plugins                                        Lists currently available plugins.
  --addPluginSbtFile=<file>                      Adds the given *.sbt file to the plugin build.
  last                                           Displays output from a previous command or the output from a specific task.
  last-grep                                      Shows lines from the last output for 'key' that match 'pattern'.
  lastGrep                                       Shows lines from the last output for 'key' that match 'pattern'.
  export <tasks>+                                Executes tasks and displays the equivalent command lines.
  show <key>                                     Displays the result of evaluating the setting or task associated with 'key'.
  print <key>                                    Prints the result of evaluating the setting or task associated with 'key' to standard output.
  all <task>+                                    Executes all of the specified tasks concurrently.
  ~ <command>                                    Executes the specified command whenever source files change.
  help                                           Displays this help message or prints detailed help on requested commands (run 'help <command>').
  completions                                    Displays a list of completions for the given argument string (run 'completions <string>').
  early(<command>)                               Schedules a command to run before other commands on startup.
  exit                                           Terminates the remote client or the build when called from the console.
  shutdown                                       Terminates the build.

More command help available using 'help <command>' for:
  !, +, ++, +-, <, ^, ^^, alias, append, apply, clearCaches, client, eval, iflast, java+, java++, onFailure, reboot, shell, startServer
sbt:gatling-parent>