Scala/ Eclipse - Files not compiling

微笑、不失礼 提交于 2019-12-24 09:19:32

问题


I added a Maven project with the "scala-archetype-simple" but post project creation, Scala source files are not being recognized by the compiler and i'm getting errors such as

"Syntax error on token ClassHeader expected instead"

and a lot of compilation errors saying "Java Problem"

How should this be fixed?


回答1:


"Add Scala Nature" might not be enough. after that if you don't see "Scala Library" in your project, you can right click the project and go to "Scala" menu then click "Add Scala Library to Build Path", then it would work.




回答2:


Right click on the project, select Configure -> Add Scala Nature. This fixes the problem instantly.




回答3:


It worked fine for me in Eclipse, but:

  • you need to have the m2eclipse-scala connector installed.
  • there are two scala-archetype-simple versions, make sure you're using version 1.5, in group net.alchim31.maven.


来源:https://stackoverflow.com/questions/15338616/scala-eclipse-files-not-compiling

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!