IDE可以使用Maven在Java中解析Scala类吗? [英] Possible for IDE's to resolve Scala classes in Java using Maven?

查看:101
本文介绍了IDE可以使用Maven在Java中解析Scala类吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个混合Java和Scala源的项目,遵循此页面,从命令行运行Maven时有效。

I have a project with mixed Java and Scala sources, following the instructions on this page, which works when running Maven from the command line.

然而,使用IDEA和Netbeans等IDE的人在使用Java解析Scala类时遇到问题代码(但不是相反,由于可用的插件很好)。有没有办法解决它们?

However, people using IDEs like IDEA and Netbeans have problems resolving Scala classes in Java code (but not the other way around, thanks to the nice plugins available). Is there a way to resolve them?

注意:我可以从命令行构建就好了; Scala类在Java类之前编译。我只是希望IDE也能识别这一点。我可以为Scala类创建一个单独的模块来解决这个问题,但对我来说似乎有点过分了。

Note: I can build from the command line just fine; the Scala classes are compiled before the Java classes. I just want the IDE to recognize this as well. I could create a separate module for the Scala classes to resolve this problem, but it seems like overkill to me.

注意:在IDEA中,我有首先编译Scala类 这仍然没有成功。

Note: In IDEA, I have "Compile Scala classes first" and that still does not do the trick.

更新:以下是我正在使用的版本:
scala-library 2.8.0
maven-scala-plugin 2.12
IDEA 9.0 Ultimate with plugin repos最新scala插件
Netbeans 6.9 scala nightly插件

Update: Here are the versions I'm using: scala-library 2.8.0 maven-scala-plugin 2.12 IDEA 9.0 Ultimate with latest scala plugin from plugin repos Netbeans 6.9 with scala nightly plugin

推荐答案

您使用的是哪些版本(Scala,IDE,Scala插件)​​?

Which versions (of Scala, the IDEs, the Scala plugins) are you using?

当我开始使用Scala 2.7时,我遇到了同样的问题几个月前。虽然我最近没有尝试过混合项目,但我的理解是这些问题将在Scala 2.8中得到解决。使用Scala 2.8尝试Eclipse 3.5.2可能是值得的 - 我的印象是Eclipse插件跟上2.8的变化比其他IDE插件更好(但我可能是错的)。

I had the same issues when I started using Scala 2.7 around 9 months ago. While I haven't tried a mixed project recently, my understanding was that the issues would be resolved in Scala 2.8. It may be worth trying Eclipse 3.5.2 with Scala 2.8 -- my impression is that the Eclipse plugin is keeping up with changes in 2.8 better than the other IDE plugins (but I could be wrong).

这篇关于IDE可以使用Maven在Java中解析Scala类吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆