1
我尝试通过Play(2.0.2)项目在Jenkins上建立构建管道。sbt and play:“test”works“test:run”not
因为我只想构建一次源代码并使用下游构建类,现在我创建了一个“compile”-job,它运行“sbt test:compile”。这工作到目前为止。
接下来的工作应该只是运行编译的测试。如果我使用“sbt test”,它会按预期工作,但会再次编译源代码。
但是,如果我尝试运行 “SBT测试:运行” 它说:
[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”。同样的错误。
有人能指点我正确的方向吗?
您是否对两个工作使用相同的工作空间? – CIGuy
此外,'test:run'运行测试源中定义的主类,类似于'compile:run'运行主源中的主类。如果没有主要课程,则没有任何课程可以运行。 –
CIGuy,是的。我正在使用相同的工作区。谢谢@Mark,我想将您的评论标记为答案。你能否再次发布它作为答案?我现在有一个不同的问题:我如何使用sbt在预编译的源代码上运行单元测试(JUnit)?我应该写一个MainClass来做到这一点吗?看来我必须添加一个[junit-interface](https://github.com/szeiger/junit-interface)作为依赖,这似乎很奇怪,因为它们运行良好,当我做“sbt clean test” – Martin