[prev in list] [next in list] [prev in thread] [next in thread] 

List:       maven-user
Subject:    Re: Side effects of import scope?
From:       Hervé BOUTEMY <herve.boutemy () free ! fr>
Date:       2022-08-26 20:23:11
Message-ID: 4743302.GXAFRqVoOG () giga
[Download RAW message or body]

Le lundi 22 août 2022, 14:41:56 CEST Delany a écrit :
> Hi Herve,
Hi Delany,
Sorry for the late answer, I was away...

> 
> The bom flattenMode in
> https://www.mojohaus.org/flatten-maven-plugin/flatten-mojo.html
> is "Like ossrh but additionally keeps dependencyManagement and properties"
> 
> If the properties are not going to be available to the importing project,
> why not resolve them in dependencyManagement and leave them out of the bom?
I don't know why this choice was done: perhaps because keeping them in BOM is 
easier, then why doing more work in the flatten-maven-plugin?

> Alternatively, if dependencyManagement should remain unresolved, why not
> import the properties, allowing them to be overwritten by the importing
> project?
who said dependencyManagement should remain unresolved?
(notice that I suppose by "unresolved" you mean with properties not 
interpolated: "resolving" has a different meaning in dependency resolution 
context, then sorry, but I need to be picky on terms)


in fact, dependencyManagement import is currently coded as I explained and 
showed in code, which is not well known by many nor have a definitive 
documentation of intent AFAIK.
Its purpose is "basic dependencyManagement import", where "basic" is about 
importing effective values.
If properties could be injected from importing project to the BOM, this would 
mean "parametrized import": this is a different use case.
If properties from bom leaked to importing project, it would not only be 
"dependencyManagement import", but "dependencyManagement and properties 
import": and precedence rules could be tricky

having properties out of import features was IMHO a great design decision for 
the intent = importing something clearly defined.

Regards,

Hervé

> 
> Regards,
> Delany
> 
> On Mon, 22 Aug 2022 at 14:28, <herve.boutemy@free.fr> wrote:
> > saying "publish these properties in a bom?" is confusing: properties from
> > the BOM are not published
> > 
> > the BOM is written using a property, for simplicity for example of
> > defining a version that is used by many dependencies
> > 
> > but that's to ease BOM writer maintenance: it does not publish anything to
> > BOM consumer
> > 
> > Regards,
> > 
> > Hervé
> > 
> > ----- Mail original -----
> > De: "Delany" <delany.middleton@gmail.com>
> > À: "Maven Users List" <users@maven.apache.org>
> > Envoyé: Vendredi 19 Août 2022 12:43:55
> > Objet: Re: Side effects of import scope?
> > 
> > >> I don't see how any property from the imported model could affect the
> > >> importing model
> > > 
> > > OK, good to know.
> > 
> > It also can't be overwritten from the importing model, so what purpose
> > does
> > it serve to publish these properties in a bom?
> > 
> > Regards,
> > Delany
> > 
> > On Thu, 18 Aug 2022 at 20:56, Laird Nelson <ljnelson@gmail.com> wrote:
> > > On Wed, Aug 17, 2022 at 11:33 PM Herve Boutemy <hboutemy@apache.org>
> > > 
> > > wrote:
> > > > I see one clarification to add to your "by value" explanation: what is
> > > > imported is the dependencyManagement content from the *effective*
> > > 
> > > imported
> > > 
> > > > model, ie with its interpolation  (properties substitution) already
> > 
> > done
> > 
> > > That's helpful; thanks.
> > > 
> > > > I don't see how any property from the imported model could affect the
> > > > importing model
> > > 
> > > OK, good to know.
> > > 
> > > > A few reference to source code:
> > 
> > > > - the importer:
> > https://maven.apache.org/ref/3.8.6/maven-model-builder/xref/org/apache/mav
> > en/model/composition/DefaultDependencyManagementImporter.html> 
> > > > - and the effective model resolution that happens before:
> > https://maven.apache.org/ref/3.8.6/maven-model-builder/xref/org/apache/mav
> > en/model/building/DefaultModelBuilder.html#L1236> 
> > > > Hope this helps
> > > 
> > > Very much, thanks.
> > > 
> > > L
> > 
> > ---------------------------------------------------------------------
> > 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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic