You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Stanimir Stamenkov <s7...@netscape.net> on 2011/06/23 00:02:27 UTC

Dependency transitivity - compilation vs. packaging

As far as I've found, currently it is not possible to specify a 
dependency scope which will cause a dependency normally packaged 
along with its compile scope dependencies in a final product like 
EAR, but will not resolve its compile scope dependencies when 
compiling the project which includes it as dependency.  That's it, I 
would like to use the APIs provided by a given dependency, but I 
don't want to allow compiling against APIs provided by its 
implementation dependencies (unless given as dependencies 
explicitly), and then I want those implementation dependencies 
packaged automatically in a final product.

I hope I've explained it good enough.  Is what I'm after currently 
possible?  If not, has this been thought about before?

-- 
Stanimir

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Dependency transitivity - compilation vs. packaging

Posted by Stanimir Stamenkov <s7...@netscape.net>.
Wed, 22 Jun 2011 15:07:02 -0700, /Manfred Moser/:

> Use a dependency to the api with provided scope on jar or whatever code
> projects you have.
>
> And then use the implementation of the api as dependency on the ear.

Yeah, that's exactly what I'm currently doing, but it easily becomes 
a nightmare with a larger project with large amount of modules, with 
even larger amount of dependencies - tracking and declaring 
explicitly the dependencies of these dependencies for packaging.  I 
want to avoid specifying implementation detail dependencies for 
packaging (which may change in a next version of the main 
dependency).  As far as I'm aware Maven encourages the practice of 
"don't repeat yourself" and the given solution obviously involves a 
lot of repetitions (in terms of dependency declarations).

Say I have an EJB module which depends on the X dependency which 
itself depends on DOM4J for certain parts of its implementation.  I 
don't want to allow my EJB module using DOM4J APIs, but I want this 
dependency automatically packaged in an EAR which packages my EJB 
module.  I think this is quite important part of the dependency 
transitivity for it to be useful.

-- 
Stanimir

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Dependency transitivity - compilation vs. packaging

Posted by Manfred Moser <ma...@mosabuam.com>.
Use a dependency to the api with provided scope on jar or whatever code
projects you have.

And then use the implementation of the api as dependency on the ear.

manfred

> As far as I've found, currently it is not possible to specify a
> dependency scope which will cause a dependency normally packaged
> along with its compile scope dependencies in a final product like
> EAR, but will not resolve its compile scope dependencies when
> compiling the project which includes it as dependency.  That's it, I
> would like to use the APIs provided by a given dependency, but I
> don't want to allow compiling against APIs provided by its
> implementation dependencies (unless given as dependencies
> explicitly), and then I want those implementation dependencies
> packaged automatically in a final product.
>
> I hope I've explained it good enough.  Is what I'm after currently
> possible?  If not, has this been thought about before?
>
> --
> Stanimir
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org