Reputation: 1449
Consider a war application having following dependency.
War A --> Jar A --> jar B
War A adds dependency of Jar A only. Gets jar B as transitive dependency. But let’s say something changes in B, then we need to build A with new version of B.Is this right thing to do? Every time B changes, A’s pom needs to pick latest changes of B. Should War A specify direct dependency of A and B both or just A?
Is there some rule which says like we should ideally declare direct dependency of only those jar of which we are directly using the API of.
In above case, there is java class from jar B which is getting called from war A.
Please help with my understanding.
Upvotes: 0
Views: 1142
Reputation: 11055
In general, it's best to keep maven's convention, and allow it to resolve transitive dependencies, so you don't swirl into a dependency hell!
If you want to test a change, you can, for testing purposes, add a direct dependency.
Keep it simple. Allow maven to manage this.
I hope this helps.
Upvotes: 1