If you actually use a dependency (in code) in a module, that dependency should always be a direct dependency of the module, either declared in the module itself or in a parent POM. From my experience, declaring dependencies (not dependencyManagement) in parent POMs comes with some disadvantages, but from your description it sounds like this approach is a good fit for you. In my case we had to do a lot of excludes in packaging modules (like ears, zips etc) before we changed to a more "proper" way of declaring dependencies.
As for the other alternative you mention. Even if you have control over all the artifacts in the build, as you seem do in this case, relying on transitive dependencies from the core module for stuff you actually use in other modules is a bad approach. It does not express true intent, and conceptually these dependencies should be direct, as stated above. Also it leaves your other modules open for "breakage" if someone in the future intentionally or accidentally changes the core module in a way you did not anticipate. On Mon, Oct 24, 2011 at 11:08, codingplayer <[email protected]>wrote: > Hi Martin, > > thanks for your hint to the <pluginManagement> section. > > But actually, that is not exaclty what i want. > Since i do not want to repeat defining each common dependency separately > for > each sub-module. > > This approach would be ideal, if i want to use this dependency in many > sub-modules (but not all), so i could skip the definition in those > sub-modules, where i do not need it. > > > If a want to have a new common dependecy which shall be used for all > sub-modules, i could simply add this dependency to the parent-pom, right? > Why would i rather put in it each module individually, what would be the > benefits? > > And why not put it into the core module (e.g. sandbox-core) , since all > other sub-modules would use the core anyway? > > br > R.C. > > -- > View this message in context: > http://maven.40175.n5.nabble.com/where-to-put-common-dependecies-in-multi-module-project-tp4931654p4931809.html > Sent from the Maven - Users mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > -- - Jan Fredrik Wedén
