You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Christian Schulte <cs...@schulte.it> on 2016/12/13 01:32:49 UTC

Question regarding repository overriding.

Consider these projects:

P1 declares a repository with id 'central' and a dependency on D1
available in that repository.

D1 declares a repository with id 'central' with a different URL and has
a dependency management import declaration on D2.

When importing D2 into the effective model of D1, which repository
should be used? Does the 'central' repository definition in D1 override
the 'central' repository definition in P1? How would you expect Maven to
behave?

Regards,
-- 
Christian

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


Re: 2nd question regarding repository overriding.

Posted by Stephen Connolly <st...@gmail.com>.
profiles are applied IMHO *after* the current pom... and whatever is in the
current pom overrides dependencies...

On 13 December 2016 at 01:57, Christian Schulte <cs...@schulte.it> wrote:

> Am 12/13/16 um 02:32 schrieb Christian Schulte:
> > Consider these projects:
> >
> > P1 declares a repository with id 'central' and a dependency on D1
> > available in that repository.
> >
> > D1 declares a repository with id 'central' with a different URL and has
> > a dependency management import declaration on D2.
> >
> > When importing D2 into the effective model of D1, which repository
> > should be used? Does the 'central' repository definition in D1 override
> > the 'central' repository definition in P1? How would you expect Maven to
> > behave?
> >
> > Regards,
> >
>
> What repository to use if there is an active profile in the settings
> also declaring a 'central' repository? That's the IT currently failing.
> The resolver does not know about those profiles. Maybe that's the real
> issue to fix. So - when there is an active profile in the settings
> declaring a 'central' repository does that profile need to get injected
> everywhere (also when building effective models of dependencies) or does
> that profile only need to get injected into the initial effective model
> and then can get ignored when building dependencies?
>
> <https://issues.apache.org/jira/browse/MNG-4347>
> <https://issues.apache.org/jira/browse/MNG-5639>
>
> The fix to MNG-5639 introduced the issue uncovered now.
>
> Regards,
> --
> Christian
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>

2nd question regarding repository overriding.

Posted by Christian Schulte <cs...@schulte.it>.
Am 12/13/16 um 02:32 schrieb Christian Schulte:
> Consider these projects:
> 
> P1 declares a repository with id 'central' and a dependency on D1
> available in that repository.
> 
> D1 declares a repository with id 'central' with a different URL and has
> a dependency management import declaration on D2.
> 
> When importing D2 into the effective model of D1, which repository
> should be used? Does the 'central' repository definition in D1 override
> the 'central' repository definition in P1? How would you expect Maven to
> behave?
> 
> Regards,
> 

What repository to use if there is an active profile in the settings
also declaring a 'central' repository? That's the IT currently failing.
The resolver does not know about those profiles. Maybe that's the real
issue to fix. So - when there is an active profile in the settings
declaring a 'central' repository does that profile need to get injected
everywhere (also when building effective models of dependencies) or does
that profile only need to get injected into the initial effective model
and then can get ignored when building dependencies?

<https://issues.apache.org/jira/browse/MNG-4347>
<https://issues.apache.org/jira/browse/MNG-5639>

The fix to MNG-5639 introduced the issue uncovered now.

Regards,
-- 
Christian


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


Re: Question regarding repository overriding.

Posted by Stephen Connolly <st...@gmail.com>.
On Thursday, 15 December 2016, Christian Schulte <cs...@schulte.it> wrote:

> Am 12/15/16 um 01:09 schrieb Christian Schulte:
> > I would have expected the nearest wins strategy as well, BTW. Seems to
> > not make sense for the resolver to just ignore repository declarations
> > matching an ID already discovered at another level.
>
> Well. Makes perfect sense for the resolver to do it that way. It also is
> consistent to the way dependency management is implemented.
>
> POM (I am authoring)
>  - dependency management I want to be applied
>  - repositories I want to be used
>  - dependencies to be resolved
>
> When resolving the dependencies for that POM, I do not want any direct
> or transitive dependency to alter *my* dependency management or *my*
> repositories. I updated the core to match that logic. Should be correct.
>
>
Yes local Pom should win.

And I think parent trumps dependency too


>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org <javascript:;>
> For additional commands, e-mail: dev-help@maven.apache.org <javascript:;>
>
>

-- 
Sent from my phone

Re: Question regarding repository overriding.

Posted by Christian Schulte <cs...@schulte.it>.
Am 12/15/16 um 01:09 schrieb Christian Schulte:
> I would have expected the nearest wins strategy as well, BTW. Seems to
> not make sense for the resolver to just ignore repository declarations
> matching an ID already discovered at another level.

Well. Makes perfect sense for the resolver to do it that way. It also is
consistent to the way dependency management is implemented.

POM (I am authoring)
 - dependency management I want to be applied
 - repositories I want to be used
 - dependencies to be resolved

When resolving the dependencies for that POM, I do not want any direct
or transitive dependency to alter *my* dependency management or *my*
repositories. I updated the core to match that logic. Should be correct.


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


Re: Question regarding repository overriding.

Posted by Christian Schulte <cs...@schulte.it>.
I would have expected the nearest wins strategy as well, BTW. Seems to
not make sense for the resolver to just ignore repository declarations
matching an ID already discovered at another level.



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


Re: Question regarding repository overriding.

Posted by Christian Schulte <cs...@schulte.it>.
Am 12/14/16 um 20:41 schrieb Stephen Connolly:
> definition nearest to the project should win is the principle that has been
> in force...

That's what Maven core developers had in mind. Maven resolver developers
did the opposite. See this class:

<https://git-wip-us.apache.org/repos/asf?p=maven-resolver.git;a=blob;f=maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultRemoteRepositoryManager.java;h=a1110b4347bc2a692de919a73edcf4020d07d740;hb=HEAD>

The dominant repository is the first declaration found. For example:

A (declares central) -> B (declares central) -> C (declares central)

The repository URL in use will always be the one declared for A. Only
mirror definitions of B and C will be merged. In Maven core the URL of
the central repository declaration of B and C would be used.

Regards,
-- 
Christian


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


Re: Question regarding repository overriding.

Posted by Stephen Connolly <st...@gmail.com>.
definition nearest to the project should win is the principle that has been
in force...

when the definition is coming from a dependency, however, the concept of
distance can become confused - especially given how the dependency graph is
version conflict reduced

On 13 December 2016 at 01:32, Christian Schulte <cs...@schulte.it> wrote:

> Consider these projects:
>
> P1 declares a repository with id 'central' and a dependency on D1
> available in that repository.
>
> D1 declares a repository with id 'central' with a different URL and has
> a dependency management import declaration on D2.
>
> When importing D2 into the effective model of D1, which repository
> should be used? Does the 'central' repository definition in D1 override
> the 'central' repository definition in P1? How would you expect Maven to
> behave?
>
> Regards,
> --
> Christian
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>