A dependency declared in a parent is always inherited. However, you might
be confused by dependencyManagement in a parent which is something
different. I believe there are resources on the Internet explaining this if
you search.

/Anders (mobile)
Den 11 nov 2011 06.25 skrev "xuhb" <[email protected]>:

> when we define dependency in parent POM, the defined dependency sometimes
> can be inherited automatically, sometimes it cannot;
> for example:
> if I define a module A in parent POM
>    <dependency>
>        <groupId>groupA</groupId>
>        <artifactId>A</artifactId>
>        <version>1.1</version>
>  </dependency>
>
> Sometimes: if I doesn't declare the anything in child module's pom, it
> will automatically  all dependency in parent POM;
> But sometimes, I find I must declare the dependency in child module, it
> cannot be automatically inherited by child module;
> Why?
>
> For example , I must declare the module A in child pom as following,
> otherwise, the child module cannot inherit dependency of parent pom; But
> the child module does inherit the version
>    <dependency>
>        <groupId>groupA</groupId>
>        <artifactId>A<artifactId>
>        <!--here we need not declare the version, the child pom will
> inherit version declare in parent POM -->
>    </depdency>
>
> So why? How could I control the way for child pom to inherit parent POM ?

Reply via email to