Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Maven in Hibernate Tutorial

I have maven installed and I'm trying to go through the hibernate tutorial. But how exactly am I suppose to use this file: http://docs.jboss.org/hibernate/stable/core/reference/en/html/tutorial.html#tutorial-firstapp-setup

What does maven need to do with it? What exactly does that file do?

like image 278
hello_world_infinity Avatar asked Aug 03 '26 03:08

hello_world_infinity


2 Answers

Maven uses a Project Object Model to describe a project. This includes definitions of the dependencies and executions to use for a project, the reports to run when building, and a host of other features. In Maven 2 that model is defined in the pom.xml (in Maven 1 the file was called project.xml).

Maven expects to find the pom.xml in the root directory of the project (though this can be overridden). When you run a Maven goal, the POM is parsed from pom.xml, Maven determines what dependencies and plugins are needed, downloading them from the remote repositories, then runs the plugins that are configured for the project.

For a jar project, running mvn install will by default perform a series of operations based on the default lifecycle bindings. You can define additional operations by adding plugin definitions to the pom and binding them to the relevant phase of the lifecycle.

The Maven book is a good guide to Maven. The Maven by Example section will walk you through the various parts of Maven configuration. If you are familiar with Ant, have a look at the Comparing Maven with Ant section to understand the differences.

like image 161
Rich Seller Avatar answered Aug 06 '26 17:08

Rich Seller


That file is called pom.xml and provides a definition of your project to maven so it would be able to build it. Save it in the root folder of your project and run mvn install from the same place to build the project. If you need more info you should read some maven documentation and tutorials.

like image 45
Gregory Mostizky Avatar answered Aug 06 '26 16:08

Gregory Mostizky



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!