【发布时间】:2013-09-07 17:08:48
【问题描述】:
我正在尝试使用 iPojo 注释在 Eclipse 中进行组件声明。问题是当它生成 XML 和修改的类时,bnd-ipojo-plugin 在插件类路径中找不到注释。
我在 Eclipse 中遇到如下错误:
During generation of a component on class org.osgi.example.Application, exception java.lang.ClassNotFoundException: org.apache.felix.ipojo.annotations.Bind
我已修改 .bnd 文件以包含“-plugins”属性:
-plugin: org.apache.felix.ipojo.bnd.PojoizationPlugin;use-local-schemas=true;path:="${workspace}/cnf/plugins/org.apache.felix.ipojo-1.10.1.jar;${workspace}/cnf/plugins/org.apache.felix.ipojo.annotations-1.10.1.jar;${workspace}/cnf/plugins/bnd-ipojo-plugin-1.10.1.jar;${workspace}/cnf/plugins/org.apache.felix.ipojo.manipulator-1.10.1.jar"
我的 Eclipse 项目的 BuildPath 中也包含所有 iPojo jar。有没有人有什么建议?或者有没有更好的方法将 iPojo 集成到 Eclipse 中?
编辑 1
我已经完全重建了我的工作区并将-plugin 和-pluginpath 变量移到了build.bnd 文件中。
现在看起来像这样:
-pluginpath: ${plugindir}/biz.aQute.repository/biz.aQute.repository-2.1.0.jar,\
${plugindir}/bnd-ipojo-plugin/bnd-ipojo-plugin-1.10.1.jar, \
${plugindir}/org.apache.felix.ipojo/org.apache.felix.ipojo-1.10.1.jar, \
${plugindir}/org.apache.felix.ipojo.annotations/org.apache.felix.ipojo.annotations-1.10.1.jar, \
${plugindir}/org.apache.felix.ipojo.manipulator/org.apache.felix.ipojo.manipulator-1.10.1.jar
-plugin: aQute.bnd.deployer.repository.LocalIndexedRepo;name=Release;local=${workspace}/cnf/releaserepo;pretty=true,\
aQute.bnd.deployer.repository.LocalIndexedRepo;name=Local;local=${workspace}/cnf/localrepo;pretty=true,\
aQute.bnd.deployer.repository.FixedIndexedRepo;name=Bndtools Hub;locations=https://github.com/bndtools/bundle-hub/raw/master/index.xml.gz,\
aQute.lib.deployer.FileRepo;name=Build;location=${workspace}/cnf/buildrepo,\
aQute.lib.deployer.FileRepo;readonly=true;name=iPojo Repo;location=${plugindir}, \
org.apache.felix.ipojo.bnd.PojoizationPlugin;use-local-schemas=true
现在所有的错误都消失了,它的构建没有失败。但是,仍然没有生成 XML 文件。除了修改 build.bnd 文件还有其他步骤吗?
【问题讨论】:
-
你在cnf/build.bnd中设置了-plugins属性了吗?放到项目的bnd.bnd文件里面是不行的。
-
谢谢。我不确定是哪一个。我已将其移至 build.bnd 并更新了问题。
-
不幸的是,我对 iPOJO 了解不多,所以我不知道它应该生成什么以及在哪里生成。但是您检查过 Eclipse 错误日志视图吗?如果出现问题,那么您有望在其中发现一些错误。
-
谢谢尼尔。我会在那里寻找一些答案。您可以为 Eclipse 推荐一个注释库吗?