i've got multi-module maven project in eclipse. has 1 jar module, "myapp-core", , bunch of .war modules. core module depends on external jars, , war modules depend on core.
the problem when build .war files, of dependencies copied web-inf/lib folders, have duplicates. right way solve problem, theoretically, give dependencies in myapp-core scope of "provided". unfortunately, when .war modules compile errors. , transitive dependencies copied anyway!
how set dependencies common across wars excluded?
(i can't exclude transitive artifacts one-by-one, unfortunately. there's 50 of them, , it's ever-changing list.)
rather "provided", can exclude transitive dependencies being pulled in artifacts, , allow other dependencies remain. e.g.,
x -depends-> b1 -depends-> c1 y -depends-> b2 -depends-> c2 -depends-> d1
then set pom have x exclude b1. end latest & greatest b , latest c (assuming b2 newer version of b1, , c2 newer version of c1). further, can declare d1 dependency, or mark "provided".
see mvnref-book/dependencies more examples, , other stackexchange q&a here
Comments
Post a Comment