scala mill ubuntu 编译helloworld
https://mikeperry.io/posts/mill-scala/
https://docs.scala-lang.org/zh-cn/
LAPTOP-FN2M7AS9:~/proj/scala$ ./mill hello.compile
[10/27] hello.resources
LAPTOP-FN2M7AS9:~/proj/scala$ ./mill hello.run
hello.finalMainClass No main class specified or found
LAPTOP-FN2M7AS9:~/proj/scala$ ./mill hello.compile
[27/27] hellofaun.compile
[info] Compiling 1 Scala source to /home/xxx/proj/scala/out/hello/compile/dest/classes
[info] Done compiling.
LAPTOP-FN2M7AS9:~/proj/scala$ ./mill hello.run
[39/39] hello.run
Hello World
编译如果能够正常运行会提示done compile,否则得话mill 工程设置得有问题,运行得时候也会提示No main class specified or found
mill hello.conpile ; mill hello.run
所依赖得环境设置是工程得目录结构如下图
./
├── amm
├── build.sc
├── hello
│ └── src
│ └── hi.scala
└── mill
build.sc 中要指定想要构建得工程得名称需要与目录名称保持一致,源文件必须放在src目录下且后缀必须是.scala,文件名可以与工程名称不同
import mill._, scalalib._
object hello extends ScalaModule {
def scalaVersion = "2.12.6"
}
.scala文件中必须要有Main 对象
package hello
object Main extends App {
println("Hello World")
}