sbt无法从runMain中找到“主”类,但是从运行中看到它

时间:2016-07-26 20:29:45

标签: sbt

使用sbt run时如下:

sbt "project epa-recon" "run"

我们发现找到了两个主要部分:

[warn] Multiple main classes detected.  Run 'show discoveredMainClasses' to see the list

Multiple main classes detected, select one to run:

 [1] com.lash.epa.recon.EPAReconApp
 [2] com.lash.epa.recon.EPAReconApp47D

那么我们应该可以使用runMain ..没有?

sbt "project epa-recon" "runMain com.lash.epa.recon.EPAReconApp"

嗯.. 不..

[warn] Multiple main classes detected.  Run 'show discoveredMainClasses' to see the list
java.lang.RuntimeException: No main class detected.
    at scala.sys.package$.error(package.scala:27)
[trace] Stack trace suppressed: run last epa-recon/compile:runMain for the full output.
[error] (epa-recon/compile:runMain) No main class detected.

这些消息是矛盾的。那么......对这里究竟是什么问题有任何见解?

1 个答案:

答案 0 :(得分:0)

我只是运行了您在问题中提供的确切语法,所以它起作用了。在Linux上使用sbt 1.2.3。

sbt "project subproject1" "runMain com.myco.SomeClassName"