SBT 会编译,但不会运行这个非常简单的项目。为什么不?
mackler@localhost:~/tmp/javahello$ sbt --version
sbt launcher version 0.12.1
mackler@localhost:~/tmp/javahello$ find .
.
./src
./src/main
./src/main/java
./src/main/java/learn
./src/main/java/learn/HelloWorld.java
mackler@localhost:~/tmp/javahello$ cat src/main/java/learn/HelloWorld.java
package learn;
class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, world");
}
}
mackler@localhost:~/tmp/learn/javahello$ sbt run
[info] Set current project to default-1004d5 (in build file:/home/mackler/tmp/javahello/)
[info] Updating {file:/home/mackler/tmp/javahello/}default-1004d5...
[info] Resolving org.scala-lang#scala-library;2.9.2 ...
[info] Done updating.
[info] Compiling 1 Java source to /home/mackler/tmp/javahello/target/scala-2.9.2/classes...
java.lang.RuntimeException: No main class detected.
at scala.sys.package$.error(package.scala:27)
[trace] Stack trace suppressed: run last compile:run for the full output.
[error] (compile:run) No main class detected.
[error] Total time: 4 s, completed Sep 22, 2013 4:14:21 PM
mackler@localhost:~/tmp/javahello$