scala的sbt最小程序编程

1.sbt最小程序编程

2.建立项目

2.1新建项目

scala的sbt最小程序编程

2.2.输入项目名称

scala的sbt最小程序编程

3.运行

运行的时候,在下载一堆东西,首次需要很多东西,代码很简单就一行

 

object HelloKeny {
  def main(args: Array[String]) = println("Hello keny风清扬!")


  def square(x: Int) = x * x


  var y=square(10)
  println("10平方="+y)


}

 

scala的sbt最小程序编程

一直等待下载,到外面用终端下载看看。

scala的sbt最小程序编程

4.运行结果

scala的sbt最小程序编程

5.sbt查看help帮助

sbt:sbtDemo> 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.
  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 build.