开发者

ScalaTest in Java Eclipse project

开发者 https://www.devze.com 2023-03-11 15:01 出处:网络
I\'m fairly new with ScalaTest, and now that I\'ve got it running with Maven, of course I\'d like to have it working well in Eclipse as well. My project is a Java project, but I want to improve my Sca

I'm fairly new with ScalaTest, and now that I've got it running with Maven, of course I'd like to have it working well in Eclipse as well. My project is a Java project, but I want to improve my Scala skills by writing the tests with ScalaTest.

I understood it so that I should right-click on my project, say "Configure" and "Add Scala Nature". Doing that, however, makes Eclipse try to compile all my Java f开发者_如何学Pythoniles with scalac, giving me a lot of "Scala Problem" entries in the problem list. Of course, not having the Scala nature gives me a lot of "Java Problem" entries in my project for all of my Scala files. How can I add the Scala nature only to src/test/scala?

Cheers

Nik


Maybe the simplest solution (in your context, i.e. classic Java project, without M2Eclipse and a Maven project) would be to have two separate projects:

  • one with only the Java Nature
  • one with the scala nature for tst.

Since you can link a directory in your second project, you don't have to move the sources of the tests(src/test/scala) from your existing file set.
You only have to exclude src/test/scala from any compilation in the first (Java only) project.

0

精彩评论

暂无评论...
验证码 换一张
取 消