我正在尝试着手进行面向方面的编程。我正在使用最新的日食(当前为12-2019)
public aspect Observer {
}
这会导致错误Syntax error on token "aspect", interface expected
根据https://www.eclipse.org/ajdt/downloads
我添加了http://download.eclipse.org/tools/ajdt/43/update
作为日食的更新站点
但是,日食告诉我某些部件无法安装
似乎缺少某些部分
无法完成安装,因为一个或多个必需项可能会找不到。正在安装的软件: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编译器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
插件引起的。
阅读有关this problem here的更多信息。
正确的解决方案是:
从正确的AspectJ
安装download link。
最新到Eclipse 4.10的更新是:http://download.eclipse.org/tools/ajdt/410/dev/update
另一个解决方案是:
卸载Eclipse。
安装Eclipse 4.3(与您的AspectJ
版本匹配)。
重试AspectJ安装。
更复杂的解决方案是:
从org.eclipse.core.runtime.compatibility
查找并生成/提取Maven repository jar文件。
将org.eclipse.core.runtime.compatibility
jar文件放入Eclipse插件目录。
以eclipse
模式运行--clean
以重建和注册添加的插件。
重试AspectJ安装。
您可能会遇到org.eclipse.core.runtime.compatibility
缺少更多的依赖项,最终将不得不加载所有相关插件(需要很长时间)。