Inheritance behaviour for MNG-5951 attributes?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Inheritance behaviour for MNG-5951 attributes?

Mark Raynsford-3
Let's say I have the following:

<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.example</groupId>
  <artifactId>a</artifactId>
  <version>1.0.0</version>
  <packaging>pom</packaging>
  <scm child.inherit.append.path="false">
    <url>https://example.com/a</url>
    <connection>scm:git:https://example.com/a</connection>
    <developerConnection>scm:git:https://example.com/a</developerConnection>
  </scm>
</project>

And then:

<project>
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>com.example</groupId>
    <artifactId>a</artifactId>
    <version>1.0.0</version>
  </parent>
  <groupId>com.example</groupId>
  <artifactId>b</artifactId>
  <version>1.0.0</version>
  <packaging>pom</packaging>
  <scm>
    <url>https://example.com/b</url>
    <connection>scm:git:https://example.com/b</connection>
    <developerConnection>scm:git:https://example.com/b</developerConnection>
  </scm>
</project>

And then:

<project>
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>com.example</groupId>
    <artifactId>b</artifactId>
    <version>1.0.0</version>
  </parent>
  <groupId>com.example</groupId>
  <artifactId>c</artifactId>
  <version>1.0.0</version>
  <packaging>jar</packaging>
</project>

So that's com.example:a:1.0.0 → com.example:b:1.0.0 →
com.example:c:1.0.0.

Would you expect com.example:c:1.0.0 to have
child.inherit.append.path="true" for the (inherited) <scm> element? It
wasn't clear exactly what semantics were intended to be. What I *think*
is happening right now is that the <scm> element in com.example:b:1.0.0
is assigned a value of child.inherit.append.path="true", because "true"
is the default if something isn't specified and it overrides the value
specified in com.example:a:1.0.0.

--
Mark Raynsford | http://www.io7m.com


attachment0 (235 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Inheritance behaviour for MNG-5951 attributes?

Mark Raynsford-3
On 2018-11-04T15:34:11 +0100
Hervé BOUTEMY <[hidden email]> wrote:

> you can build https://github.com/apache/maven/tree/MNG-6059 with quick build
> instruction at the end of README
>

Thanks. I've built 523db580468bc2b9d8420470bb24f5f688220701 and it
seems to be working for all but the
project/distributionManagement/site/@child.site.url.inherit.append.path
element. I have this in my organization-wide POM:

  https://github.com/io7m/primogenitor/blob/release/3.0.0-beta0019/pom.xml#L126

I then use the property in BND bundle manifests:

  https://github.com/io7m/primogenitor/blob/release/3.0.0-beta0019/pom.xml#L433

The $[...] syntax is just BND-speak for "expand this property as late
as possible". Using the traditional ${...} syntax can cause those
properties to be expanded too early, resulting in the values as they
appeared in the parent being used in child modules.

Then, in a descendant project:

  https://github.com/io7m/junreachable/blob/release/3.0.0/pom.xml#L39
  https://github.com/io7m/junreachable/blob/release/3.0.0/pom.xml#L60

If I look at the resulting OSGi manifest for the
com.io7m.junreachable.core module, I see:

Bundle-Description                       Exception types for marking unreachable/unimplemented code (Core)
Bundle-DocURL                            https://www.io7m.com/software/junreachable/com.io7m.junreachable.core
Bundle-ManifestVersion                   2                                      
Bundle-Name                              com.io7m.junreachable.core 3.0.0 - Exception types for marking unreachable/unimplemented code (Core)
Bundle-SCM                               https://github.com/io7m/junreachable   
Bundle-SymbolicName                      com.io7m.junreachable.core              
Bundle-Vendor                            io7m.com                                
Bundle-Version                           3.0.0                                  
Export-Package                           com.io7m.junreachable;version="3.0.0"  
Implementation-Build                     e519345f73b1d2f4c9393eadbf9909ac361a0751
Implementation-Title                     com.io7m.junreachable.core              
Implementation-Vendor                    io7m.com                                
Implementation-Vendor-Id                 com.io7m.junreachable                  
Implementation-Version                   3.0.0                                  
Manifest-Version                         1.0                                    
Require-Capability                       osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=11))"
Sealed                                   true                                    
Specification-Title                      com.io7m.junreachable.core              
Specification-Vendor                     io7m.com                                
Specification-Version                    3.0.0

So you can see that the Bundle-SCM field, which is built from
${project.scm.url}, has the correct non-appended value. However,
Bundle-DocURL, which is built from
${project.distributionManagement.site.url}, still has the module
name appended to it.

--
Mark Raynsford | http://www.io7m.com


attachment0 (235 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Inheritance behaviour for MNG-5951 attributes?

Mark Raynsford-3
On 2018-11-04T15:05:19 +0000
Mark Raynsford <[hidden email]> wrote:

> On 2018-11-04T15:34:11 +0100
> Hervé BOUTEMY <[hidden email]> wrote:
>
> > you can build https://github.com/apache/maven/tree/MNG-6059 with quick build
> > instruction at the end of README
> >  
>
> Thanks. I've built 523db580468bc2b9d8420470bb24f5f688220701 and it
> seems to be working for all but the
> project/distributionManagement/site/@child.site.url.inherit.append.path
> element.
Here's a more isolated example:

  https://github.com/io7m/mng-6059-examples/tree/develop/abc

Note that the jar in the 'c' module has the following fields:

  Manifest-Version: 1.0
  Archiver-Version: Plexus Archiver
  Created-By: Apache Maven 3.6.1-SNAPSHOT
  Built-By: rm
  Build-Jdk: 11
  Field-SCM: https://github.com/io7m/mng-6059-examples
  Field-Site: https://www.io7m.com/software/mng-6059-examples/com.io7m.c
  Field-URL: http://www.io7m.com/

The Field-SCM and Field-URL attributes have the automatic appending
correctly disabled, but the Field-Site attribute still has the module
appended despite the fact that the site element in
distributionManagement has child.site.url.inherit.append.path="false".

--
Mark Raynsford | http://www.io7m.com


attachment0 (235 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Inheritance behaviour for MNG-5951 attributes?

Hervé BOUTEMY
Hi Mark,

even if this is somewhat a corner case (while overriding everything in b, you
can override the attribute also), it is strange...

The more immediate check is to run "mvn help:effective-pom" on b to check that
child.site.url.inherit.append.path is configured: I still don't understand
why, but it is not.

I can reproduce the issue in an inheritance unit test (no-append-urls in
maven-model-builder), but still need to investigate why it does not work as
intended by ModelMerger.mergeSite(...): you can easily check by removing
"name" field in b, you'll see that merge for other fields does not work

I'll investigate later, it's late here now :)

Regards,

Hervé

Le lundi 5 novembre 2018, 13:19:43 CET Mark Raynsford a écrit :

> On 2018-11-04T15:05:19 +0000
>
> Mark Raynsford <[hidden email]> wrote:
> > On 2018-11-04T15:34:11 +0100
> >
> > Hervé BOUTEMY <[hidden email]> wrote:
> > > you can build https://github.com/apache/maven/tree/MNG-6059 with quick
> > > build instruction at the end of README
> >
> > Thanks. I've built 523db580468bc2b9d8420470bb24f5f688220701 and it
> > seems to be working for all but the
> > project/distributionManagement/site/@child.site.url.inherit.append.path
> > element.
>
> Here's a more isolated example:
>
>   https://github.com/io7m/mng-6059-examples/tree/develop/abc
>
> Note that the jar in the 'c' module has the following fields:
>
>   Manifest-Version: 1.0
>   Archiver-Version: Plexus Archiver
>   Created-By: Apache Maven 3.6.1-SNAPSHOT
>   Built-By: rm
>   Build-Jdk: 11
>   Field-SCM: https://github.com/io7m/mng-6059-examples
>   Field-Site: https://www.io7m.com/software/mng-6059-examples/com.io7m.c
>   Field-URL: http://www.io7m.com/
>
> The Field-SCM and Field-URL attributes have the automatic appending
> correctly disabled, but the Field-Site attribute still has the module
> appended despite the fact that the site element in
> distributionManagement has child.site.url.inherit.append.path="false".





---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Inheritance behaviour for MNG-5951 attributes?

Mark Raynsford-3
In reply to this post by Mark Raynsford-3
On 2018-11-10T16:47:59 +0100
Hervé BOUTEMY <[hidden email]> wrote:

> ok, I investigated more in details and added a little trick in [1]:
> child.site.url.inherit.append.path is inherited independantly from id/name/url
>
> this will manage your edge case, which I can understand is expected
>
> do you think it is ok?

I'll build and test this shortly! Thanks.

--
Mark Raynsford | http://www.io7m.com


attachment0 (235 bytes) Download Attachment