I'm trying to use the iPojo annotations for component declaration inside Eclipse. The issue is that when it's generating the XML and modified classes the bnd-ipojo-plugin can't find the annotations in the plugin classpath.
I get errors in Eclipse like this:
During generation of a component on class org.osgi.example.Application, exception java.lang.ClassNotFoundException: org.apache.felix.ipojo.annotations.Bind
I have modified the .bnd file to contain the '-plugins' property:
-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"
My Eclipse project has all the iPojo jars in the BuildPath as well. Does anyone have any suggestions? Or is there a better way to integrate iPojo into Eclipse?
Edit 1
I have completely rebuilt my workspace and moved the -plugin
and -pluginpath
variables to the build.bnd file.
It now looks something like this:
-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
Now all the errors are gone and it builds without failing. However, the XML files are still not being generated. Is there another step besides altering the build.bnd file?
I switched to BndTools SCR annotations over iPojo. I liked the expressiveness of the iPojo annotations, but I found the SCR annotations to be just as enjoyable. Since they are built into BndTools, they work as expected. Although the specification (pg. 187) proved very useful in making sure I was using them correctly (ie. properties vs property).