Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have a project with 5 modules.

2 of the modules have a dependency of hibernate. they are siblings and not parent child hence one cannot inherit another one's dependencies

is there a way to specify hibernate related dependency in parent and make the 2 modules inherit it and the other 3 modules wont inherit it.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
793 views
Welcome To Ask or Share your Answers For Others

1 Answer

Yes there is. Create a parent pom.xml with the shared hibernate dependency and add a parent declaration to your 2 modules:

<parent>
    <groupId>...</groupId>
    <artifactId>...</artifactId>
    <version>...</version>
    <relativePath>...path-to-parent.../pom.xml</relativePath>
</parent>

Declare the hibernate dependency in the dependencies section of your parent pom:

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate</artifactId>
        <version>${hibernate.version}</version>
    </dependency>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...