Upgrading to a new version of Hibernate under Eclipse
Joined: Mar 28, 2009
Please don't RTFM me, I am under a deadline, I am not familiar with Maven and need to upgrade to a newer Hibernate (production version).
I downloaded all parts of Hibernate and unzipped them into a separate Hibernate Eclipse project. I did not rebuild it; just added all jars to the Java Build Path | Libraries at Hibernate project, then included the Hibernate project as a dependency at my application project. Surprisingly, that did not make any of those jars visible from the application project (even though they do appear at Order and Export of the Hibernate project.. hmm), so I had to repeat that step again at my application project.
Now the problem is more subtle, since different sub-projects of Hibernate (annotations-3.4.0.GA, distribution-3.3.2.GA, entitymanager-3.4.0.GA, search-3.1.1.GA, validator-3.1.0.GA), even though https://www.hibernate.org/6.html says they work together, seem to rely different versions of the dependent libraries.
and some others, different versions apparently, so the order of classpath becomes important. When I do it by trial and error, I get a NonExistentField exception or something, which, again, tells me of version incompatibility with jars.
I don't want to do it by brute force, since there are just too many jars, and there has to be a straightforward way of doing it? Maybe based on Maven? Again, I don't know Maven, and no time to learn now.
Let me see if I understand this correctly. You are trying to use Eclipse to build a project that uses Hibernate and you are running into issues with convincing Eclipse to including all the necessary JAR files in classpath for the build. Is that a reasonable summary if the issue?
Yes. Maven will help solve this. So will Ant. But if you know neither and you are under a deadline...
I'm not sure what to tell you for the short term. I never rely on Eclipse to do my builds (except for the occasional simple toy app) because I don't like surprises. By doing all of my builds via Maven or Ant means I know exactly what I am getting.
One thing you might try: Install m2eclipse. Then create a new Maven project and add Hibernate to the dependencies. Then add you code to that project. Only add a JAR that Hibernate depends on if your code uses it directly. Then let Maven take care of the transitive dependencies.
Peter Johnson wrote:One thing you might try: Install m2eclipse. Then create a new Maven project and add Hibernate to the dependencies. Then add you code to that project. Only add a JAR that Hibernate depends on if your code uses it directly. Then let Maven take care of the transitive dependencies.
Perfect. I'll try, thanks!
Joined: Mar 28, 2009
How do you specify a custom repository directory? My C: drive is full. from reading mvn.bat, I figured that specifying a %HOME% variable would help.. it did not.