使用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.
这些消息是矛盾的。那么 .. 对这里的实际问题有什么见解吗?
最佳答案
我只是运行了您在问题中提供的确切语法,并且成功了。在 Linux 上使用 sbt 1.2.3。
sbt "project subproject1" "runMain com.myco.SomeClassName"
关于sbt 无法从 runMain 中找到 "main"类,但可以从运行中看到它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38599313/