serhii
serhii

Reputation: 1177

Maven hibernate dependecy without version. Spring petclinic

Studying spring-project example, i have found a code fragment:

        <!-- HIBERNATE -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
        </dependency>

It works fine there, but when I tried to add the same fragment into my pom.xlm, I got [ERROR] 'dependencies.dependency.version' for org.hibernate:hibernate-entitymanager:jar is missing.

Give me explanation, why it works here https://github.com/spring-projects/spring-petclinic/blob/master/pom.xml, but doesn't work in generic pom.xml.

Upvotes: 0

Views: 116

Answers (2)

Shmulik Klein
Shmulik Klein

Reputation: 3914

This is becasue it uses <dependencyMangement> to import platform-bom which is essentially a POM artifact which defines the default dependencies.

Maven using it to resolve the Hibernate dependency's version (Maven must know the 3 GAV properties to identify the artifact).

Upvotes: 1

wjans
wjans

Reputation: 10115

Make sure to include the bom in your <dependencyManagement> section as well. This bom includes the version for all dependencies.

See this for more information on bom's.

Upvotes: 1

Related Questions