简体   繁体   中英

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.

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).

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM