Hi!

Define the versions of your dependencies in the parent's 
<dependencyManagement> section. Define the actual dependency in every 
submodule where you use it. Without the version!

The analyze goal of the maven-dependency-plugin can help you to find out if 
you should declare a dependency or not.

hth,
- martin

On Monday 24 October 2011 codingplayer wrote:
> Hi,
>
> i'm wondering where to put my common dependenies in my multimodule
> project.
>
> Let's say, we have a project called sandbox, with three submodules.
> - sandbox-core
> - sandbox-service
> - sandbox-web
>
> Existing dependencies:
> - sandbox-service has a dependency to sandbox-core
> - sandbox-web has a dependency to sandbox-service
>
> So practically, all dependencies of sandbox-core, will be transitive
> dependencies for the other modules.
>
>
> Let's say i want to use slf4j as logging framework, which should probable
> be used in all modules and all of them should also use the same version.
>
> I see different approaches on this:
> - i could add the dependencies to the parent pom (sandbox)
> - i could also only define a property for the version, e.g.
> ${slf4j.dependency.version} in the parent pom (sandbox) and actually add
> the dependency on core level (sandbox-core)
> - i could also simply add the dependency (plus version) to the core level
> (sandbox-core)
>
> I already had some problems, when not building the whole project (on
> sandbox) level, that not all dependencies have been resolved in my leave
> module (sandbox-web).
>
> So i assume when putting the dependencies in the sandbox-core, one will
> always have to build the whole project in order to have a working
> sandbox-web module, while when putting them into the parent directly, the
> dependencies would be retrieved by maven correctly anyway, since the
> parent-poms are always taken intoconsideration, even when only the
> sandbox-web is built.
>
>
> So, what would be the best-practice on that?
> What exact differences would be there between direct dependencies and
> transitive dependencies?
> Where should i put those common dependencies?
>
> br
> R.C.
>
>
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/where-to-put-common-dependecies-in-multi
>-module-project-tp4931654p4931654.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]


Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to