Declaring "upstream-library" with scope "runtime" in the
dependencyManagement section of "my-project" should do it. However, I don't
see the real benefit of going through this hassle.

/Anders

On Wed, Dec 27, 2017 at 11:30 AM, Nick Stolwijk <[email protected]>
wrote:

> But I think that he wants it transitive, but only at runtime scope instead
> of compile time.
>
> I also wondered a while ago if this was possible. It would be nice to keep
> clean projects clean. (As in, declared all compile time dependencies
> instead of relying on transitive compile time dependencies.)
>
> Would implementing this be an addition to the dependencies plugin?
> (crossing fingers, I guess this is done in Maven itself and not in a
> plugin).
>
> Nick Stolwijk
>
> ~~~ Try to leave this world a little better than you found it and, when
> your turn comes to die, you can die happy in feeling that at any rate you
> have not wasted your time but have done your best ~~~
>
> Lord Baden-Powell
>
> On Wed, Dec 27, 2017 at 10:54 AM, Stephen Connolly <
> [email protected]> wrote:
>
> > So you could have scope=compile&optional=true (which means the dep is
> > non-transitive)
> >
> > On Wed 27 Dec 2017 at 00:26, Andy Feldman <[email protected]> wrote:
> >
> > > On Dec 26, 2017 11:34, "Stephen Connolly" <stephen.alan.connolly@gmail.
> > com
> > > >
> > > wrote:
> > >
> > > On Sun 24 Dec 2017 at 18:01, Andy Feldman <[email protected]>
> wrote:
> > >
> > > > Assuming I have a dependency relationship of "my-project ->
> my-library
> > ->
> > > > upstream-library", with each dependency in compile scope, I know that
> > > > my-project transitively picks up a compile scope dependency on
> > > > upstream-library. Reading the documentation at
> > > >
> > > > https://maven.apache.org/guides/introduction/
> > introduction-to-dependency-
> > > mechanism.html
> > > <https://maven.apache.org/guides/introduction/
> > introduction-to-dependency-mechanism.html>
> > > > I see a note about this transitive dependency:
> > > >
> > > > "(*) Note: it is intended that this should be runtime scope instead,
> so
> > > > that all compile dependencies must be explicitly listed - however,
> > there
> > > is
> > > > the case where the library you depend on extends a class from another
> > > > library, forcing you to have available at compile time. For this
> > reason,
> > > > compile time dependencies remain as compile scope even when they are
> > > > transitive."
> > > >
> > > > If I know that my-library does not have this issue, is there any way
> to
> > > > declare the dependencies such that I can get the intended behavior? I
> > > want
> > > > upstream-library to be picked up as runtime scope for my-project, not
> > as
> > > > compile scope.
> > >
> > >
> > > Declare it with scope “runtime”?
> > >
> > >
> > > It needs to be compile scope in my-library since my-library uses
> classes
> > > from upstream-library. I'd like to avoid declaring upstream-library at
> > all
> > > in my-project if possible, since my-project has nothing to do with
> > > upstream-library.
> > >
> > >
> > > >
> > > >
> > > > Thanks,
> > > > --
> > > > Andy Feldman
> > > >
> > > --
> > > Sent from my phone
> > >
> > --
> > Sent from my phone
> >
>

Reply via email to