且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将scala功能添加到现有的EJB eclipse项目中

更新时间:2022-10-18 15:38:14

您应该能够右键单击项目,转到Scala,然后单击添加scala性质。那么 .scala 文件应该被识别。您可能还需要将Scala库添加到依赖关系中。根据这是否是一个简单的Eclipse项目,或者您使用的是Maven,可能还需要其他步骤。


I have an existing EJB project set up in Eclipse Helios, and would like to slowly introduce Scala into the project. The Scala IDE has been installed successfully, and I'm able to create standalone scala project. The issue however comes when trying to use my existing project with scala additions. I've went as far as manually editing the .project, .classpath, and related files under .settings of the project's home directory for eclipse.

However I still have the issue where the Java compiler tries to compiles .scala classes, which results in errors and ultimately not being able to build the project.

Has anyone faced a similar scenario or are there any workarounds?

Thanks in advance.

You should be able to right-click the project, go to "Scala" and click on "add scala nature". Then .scala files should be recognized as such. You might also have to add the scala library to your dependencies. Depending on whether this is a "simple" Eclipse project or you're using Maven there might be other steps required.