views:

142

answers:

1

I have a project A which has a dependency X. Dependency X has an optional dependency Y which doens't get included in A by default. Is there a way to include Y in my POM without explicitly including it? In Ivy they have a way to essentailly say include all optional dependencies of X, does Maven have a way to do this?

A: 

According to the Maven docs:

Optional dependencies - If project Y depends on project Z, the owner of project Y can mark project Z as an optional dependency, using the "optional" element. When project X depends on project Y, X will depend only on Y and not on Y's optional dependency Z. The owner of project X may then explicitly add a dependency on Z, at her option. (It may be helpful to think of optional dependencies as "excluded by default.")

Jon Todd
This doesn't help you very much since you need to include the version of Z, so if Y changes, X needs to change his pom.
disown