What is the difference between transitive dependency and direct dependency?

1.0K    Asked by NishitaChoudhary in Devops , Asked on Feb 10, 2020

Direct dependency takes place in the tag. One thing to confirm is to use direct dependencies for tasks users are literally required to perform in their code. There might be a lot more dependencies described in the start but regulate unused dependencies in stipulated time & to make their POM crisp and clear. Keep away from using dissimilar dependent jars/libraries to fulfill the like purpose. Avoid transitive dependencies to resolve various conflicts, like it was in "dependency mediation".

        orgztn.janBask

        janBask

        1.X.X

        compile


Transitive dependencies reside in in parent POM. Beware of utilizing transitive dependency(ies) implicit:provide a direct dependency for transitive deps to re-utilize in app code. Make sure that implicit utilization is not included by mistake during each build. Explicitly declare versions of transitive dependencies in use by multiple direct dependencies.

Key Differences are:

permits to integrate all dependencies (whichever, used in Child POM) used across separate modules which leads in more transparency and centrally managed dependent libraries' version.

permits to promote/demote dependencies based on requirement, in different contexts, the same needs to be implemented at every child pom file which leads to consistent behavior throughout.

dependencies provided in tag are regularly imported, while dependencies provided at in parent pom will be imported only if child pom has a respective entry in its tag.



Your Answer

Interviews

Parent Categories