我尝试使用 Play(2.0.2) 项目在 Jenkins 上建立构建管道。
由于我只想构建一次源代码并使用这些类进行下游构建,因此我现在创建了一个“编译”作业,该作业运行“sbt test:compile”。到目前为止,这有效。
接下来的工作应该只运行编译后的测试。如果我使用“sbt test”,它会按预期工作,但会再次编译源代码。
但是如果我尝试运行“sbt test:run”,它会说:
[info] Loading project definition from ~/myproject/project
[info] Set current project to myproject (in build file: ~/myproject/)
java.lang.RuntimeException: No main class detected.
at scala.sys.package$.error(package.scala:27)
[error] {file:~/myproject/test:run: No main class detected.
同样的情况也发生在本地。我可以运行“sbt test”,但不能运行“sbt test:run”。同样的错误。
有人可以给我指出正确的方向吗?
最佳答案
test:run
运行测试源中定义的主类,类似于 compile:run
运行主源中的主类。如果没有主类,就没有什么可运行的。
关于java - sbt 并 Play : "test" works "test:run" not,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11247650/