Dr.*_*ath 1 java eclipse aspectj
我正在尝试开始面向方面的编程。我正在使用最新的 eclipse(当前为 2019 年 12 月)
public aspect Observer {
}
Run Code Online (Sandbox Code Playgroud)
这会导致错误
Syntax error on token "aspect", interface expected
根据https://www.eclipse.org/ajdt/downloads
我添加了 http://download.eclipse.org/tools/ajdt/43/update
作为 eclipse 的更新站点
但是eclipse告诉我有些部分无法安装
看起来有些零件缺失了
无法完成安装,因为找不到一项或多项所需的项目。正在安装的软件:AspectJ 开发工具 2.2.3.e43x-RELEASE-20130627-0800 (org.eclipse.ajdt.feature.group 2.2.3.e43x-RELEASE-20130627-0800) 缺少要求:AspectJ 1.7.3.20130613144500-a ( org.aspectj.ajde 1.7.3.20130613144500-a) 需要 'osgi.bundle; org.eclipse.core.runtime.compatibility 0.0.0',但找不到无法满足依赖关系:来自:AspectJ Compiler 1.7.3.20130613144500-a(org.aspectj.feature.group 1.7.3.20130613144500-a)到:org. eclipse.equinox.p2.iu;org.aspectj.ajde [1.7.3.20130613144500-a,1.7.3.20130613144500-a] 无法满足依赖关系:来自:AspectJ 开发工具 2.2.3.e43x-RELEASE-20130627-0800 (org.eclipse.ajdt.feature.group 2.2. 3.e43x-RELEASE-20130627-0800) 至:org.eclipse.equinox.p2.iu;org.aspectj.feature.group [1.7.3.20130613144500-a,1.7.3.20130613144500-a]
如何让 Aspects 在 Eclipse 中运行?你能帮我一下吗?
您的问题是由于从 Eclipse 4.6 中删除org.eclipse.core.runtime.compatibility
插件引起的。
请在此处阅读有关此问题的更多信息。
正确的解决办法是:
AspectJ
从正确的下载链接安装。
最新更新到 Eclipse 4.10 的是: http ://download.eclipse.org/tools/ajdt/410/dev/update
另一个解决方案是:
卸载 Eclipse。
安装 Eclipse 4.3(与您的AspectJ
版本匹配)。
重试 AspectJ 安装。
更复杂的解决方案是:
从Maven 存储库中找到并构建/提取org.eclipse.core.runtime.compatibility
jar 文件。
将org.eclipse.core.runtime.compatibility
jar 文件放入 Eclipse 插件目录中。
eclipse
在模式下运行--clean
以重建并注册添加的插件。
重试 AspectJ 安装。
您可能会遇到更多缺少的依赖项org.eclipse.core.runtime.compatibility
,最终将不得不加载所有相关的插件(长时间的努力)。