I'm working on an OSGi/Equinox plugin and cannot seem to get the Hibernate dependencies working. I've adde开发者_StackOverflow中文版d the Hibernate dependencies to my POM with Eclipse and it has successfully downloaded them.
However, I simply cannot use them in any project classes - as if they have not even been added as dependencies.
Why can I not simply add Hibernate as a dependency and then use it in my code? What's missing?
I know this should be really straight forward and I assume I'm missing something somewhere. A little pointer would be greatly appreciated.
Cheers
I assume you are using Eclipse Plug-in Development Environment (PDE)? If so, you need to add the package org.hibernate.cfg
(and probably others) to the imported packages for your bundle (go to the Dependencies tab of the manifest editor).
PDE's approach is to only allow your code to see packages that you have explicitly imported first. Other tools such as Bndtools allow your code to see all packages on the build path, and subsequently generate the OSGi Import-Package
statement based on what you actually used.
After adding to your pom you build it as mavne project or eclipse project? I mean build first as;
mvn clean install
Then create a eclipse project
mvn eclipse:eclipse -o
Then import that to workspace ..You will be able to use the libraries
精彩评论