在 Eclipse 项目中混合 AspectJ 和 Scala
有人能够让 Scala 和 AspectJ (AJDT) 在 Eclipse 3.6 中很好地协同工作吗?
看来 Scala 的编织器与 AspectJ 的编织器冲突。 我希望我只是错过了一些东西。
编辑:在同一个项目中玩得很好
Any one been able to get a Scala and AspectJ (AJDT) to play nicely together in Eclipse 3.6?
It seems Scala's weaver conflicts with AspectJ's weaver.
I'm hoping I'm just missing something.
Edit: Play nicely in the same project
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
根据您上面的评论,您似乎希望在一个项目中同时使用 AspectJ 构建器和 Scala 构建器。这是不可能的。每个编译器都委托给自己的编译器,并且这两个编译器(尚)不兼容。 Scala 编译器可以一起构建 Java 和 Scala 代码,AspectJ 编译器可以一起构建 AspectJ 和 Java 代码,但仅此而已。
如果您希望方面应用于 Scala 代码,则必须将 AspectJ 和 Scala 代码分离到不同的项目中,然后将 Scala 项目添加到 AspectJ 项目的 inpath 中。
如果您从 ant 或命令行进行编译,这与您需要执行的操作相同。
Based on your comment above, it looks like you want a single project to use both the AspectJ builder and the Scala builder. This is not possible. Each one delegates to its own compiler and the two compilers are not (yet) compatible. The Scala compiler can build Java and Scala code together, and the AspectJ compiler can build AspectJ and Java code together, but that's it.
If you want aspects to apply to your Scala code, you must separate your AspectJ and Scala code into different projects and then add the Scala project to the inpath of your AspectJ project.
This is the same thing that you would need to do if you were compiling from ant or the command line.
目前推荐的版本是仍然是Eclipse3.5.2。
门票,例如 1000075 或 3251 提及:
今天,您可以尝试使用 Helios 3.6 的当前每晚版本为:
http ://download.scala-ide.org/nightly-update-master-2.8.1.final
Right now, the recommended version is still Eclipse3.5.2.
Tickets like 1000075 or 3251 mention:
Today, the current nightly you could try with Helios 3.6 would be:
http://download.scala-ide.org/nightly-update-master-2.8.1.final
我已经为此苦苦挣扎了一段时间了。这是我的解决方案:
首先,将 Scala 和 AspectJ 代码分离到不同的项目中。
然后将 Ant 构建器添加到您的 Scala 项目中。只要 scala 构建器运行并进行编织,它就会运行。它使用 ant4eclipse 提取类路径,但您必须提供 scala 库的位置。
构建.xml:
I've been struggling with this for some time now. Here is my Solution:
First, separate your Scala and your AspectJ code into different projects.
Then add an Ant builder to your Scala project. It runs whenever the scala builder runs and does the weaving. It uses ant4eclipse to extract the classpath, but you'll have to supply the location of the scala library.
Build.xml:
您的意思是同时安装 Scala 插件和 AJDT 吗?这绝对是可行的——例如,开发 Scala 插件本身就需要它。
我执行以下操作:
Do you mean having both the Scala plug-in and AJDT installed simultaneously? This is definitely doable -- it's needed for developing the Scala plug-in itself, for example.
I do the following: