¿Debo incluir todas las dependencias de Maven para hibernate.jar?

I have project that uses Hibernate: hibernate-core-3.6.7.Final.jar

In its POM I found:


Should I include all dependencies in my application or does Maven do that itself?

preguntado el 03 de mayo de 12 a las 08:05

3 Respuestas

Si especifica un <dependency> en tu pom.xml , not only its jars will be downloaded to your local repository , but a POM file will also be downloaded . Maven will then look for the information in such POM file to find out what other libraries it needs to retrieve. This is what the idea of Maven 's transitive dependencies feature

So , it relies on the accuracy and completeness of such POM files stored on the public repository.If the dependencies in such POM file are not updated or empty , you have to supply the dependencies explicitly in your own pom.xml si necesario.

For hibernate , hibernate-core already depends on hibernate-jpa-2.0-api Lo que significa que hibernate-jpa-2.0-api will be download if you include hibernate-core en la pom.xml . Entonces , hibernate-jpa-2.0-api is redundancy and can be removed.

If you want to use JPA interface with the hibernate , you can just include hibernate-entitymanager en la <dependency> como depende de hibernate-core and hence will download it too.

To conclude, I suggest you simply include hibernate-entitymanager en la <dependency> :


contestado el 03 de mayo de 12 a las 09:05

Maven is used for that. You should install the m2 plugin for Eclipse (if you're coding on eclipse) and then right click on your project -> Update Project Dependencies.
But Maven is used for that, it means that when you add a dependency in your project, Maven will download the libs, and add them in the right place in your project.

contestado el 03 de mayo de 12 a las 08:05

All the dependencies that you need, you will have to add manually in your pom.xml file. If configured properly, maven will automatically download all the libraries corresponding to the dependencies you added there and they will be ready to use in your applicaiton.

contestado el 03 de mayo de 12 a las 09:05

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.