我正在尝试使用iPojo注释来实现Eclipse内部的组件声明。问题是,当生成XML和修改类时,无法在插件类路径中找到注释。
在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"我的iPojo项目也在BuildPath中包含了所有的BuildPath jars。有人有什么建议吗?还是有更好的方法将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文件之外,还有其他步骤吗?
发布于 2013-09-10 03:13:37
我切换到了BndTools SCR注释,而不是iPojo注释。我喜欢iPojo注释的表现力,但我发现SCR注释同样令人愉快。因为它们是内置到BndTools中的,所以它们按照预期工作。尽管规格(pg. )187)在确保我正确使用它们方面非常有用(即。财产对财产)。
发布于 2019-01-10 09:55:21
我也遇到了同样的问题,并通过将构建为一个包含所有依赖项的胖jar来实现它。我从这里得到了一个想法:https://groups.google.com/forum/#!topic/bndtools-users/0IqYbXOxn3Q
我获取了源代码并将其添加到pom.xml中:
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>assemble-all</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
...然后,我将生成的jar作为插件添加到build.bnd中,如下所示:
-plugin: org.apache.felix.ipojo.bnd.PojoizationPlugin;path:="${workspace}/cnf/plugins/bnd-ipojo-plugin-1.12.1-jar-with-dependencies.jar";use-local-schemas=true这样才能正常工作。
https://stackoverflow.com/questions/18675827
复制相似问题