You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Mark Hobson <ma...@gmail.com> on 2005/09/13 23:07:33 UTC

[m2] resources block not merged with profiles?

Didn't want to file a bug if this was a conscious design decision, but
with the following POM:

<project>
  ...
  <build>
    <resources>
      <resource>a</resource>
    </resources>
  </build>
  <profiles>
    <profile>
      ...
      <build>
        <resources>
          <resource>b</resource>
        </resources>
      </build>
      ...
    </profile>
  </profiles>
  ...
</project>

Shouldn't the effective resources block consist of both 'a' and 'b'
when the profile is activated?  Currently 'b' overrides 'a'.

Cheers,

Mark

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


Re: [m2] resources block not merged with profiles?

Posted by Mark Hobson <ma...@gmail.com>.
http://jira.codehaus.org/browse/MNG-895

On 13/09/05, Mark Hobson <ma...@gmail.com> wrote:
> Didn't want to file a bug if this was a conscious design decision, but
> with the following POM:
> 
> <project>
>   ...
>   <build>
>     <resources>
>       <resource>a</resource>
>     </resources>
>   </build>
>   <profiles>
>     <profile>
>       ...
>       <build>
>         <resources>
>           <resource>b</resource>
>         </resources>
>       </build>
>       ...
>     </profile>
>   </profiles>
>   ...
> </project>
> 
> Shouldn't the effective resources block consist of both 'a' and 'b'
> when the profile is activated?  Currently 'b' overrides 'a'.
> 
> Cheers,
> 
> Mark
>

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


Re: MNG-895 discussion

Posted by Brett Porter <br...@apache.org>.
John Casey wrote:

>
> P.S. My personal view on this is that profiles are meant primarily for
> augmentation, and secondarily for overriding...this would lead me to
> conclude that resource lists should be merged wherever the resource keys
> don't conflict (what's the key for a resource? probably it's dir).
> That's the way I'm leaning for implementing/fixing 895, but I'd like to
> solicit as much feedback as I can. -J
>
Sorry, missed this before firing off the new thread. I've put a few
alternatives down for MNG-895.

I don't think there is such a thing as keys in resources. Merging is
completely additive, or non-existent.

- Brett

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


Re: MNG-895 discussion (was: Re: [m2] resources block not merged with profiles?)

Posted by Mark Hobson <ma...@gmail.com>.
On 16/09/05, John Casey <jd...@commonjava.org> wrote:
> Basically, there was a problem with the release plugin, wherein a
> profile with an empty resources list was overriding the default
> resources list from the super-POM. It's not really another use case for
> the merge vs. override discussion, but it did highlight part of the
> resource handling during profile injection, which is why I referred it
> to 895. To fix this bug, I just put in a piece of code to check whether
> the profile's resources list is empty (in addition to a null check)
> before it overrode the model resources. I haven't addressed the override
> vs. merge topic yet.
> 
> Sorry for the false alarm! :)

No worries, I was just interested as to what had linked these two
issues together :)

> P.S. My personal view on this is that profiles are meant primarily for
> augmentation, and secondarily for overriding...this would lead me to
> conclude that resource lists should be merged wherever the resource keys
> don't conflict (what's the key for a resource? probably it's dir).
> That's the way I'm leaning for implementing/fixing 895, but I'd like to
> solicit as much feedback as I can. -J

I'd certainly agree - I don't see much in a profile that shouldn't be
merged with it's POM.  If a user wishes to override something in their
POM within a profile, then couldn't the part that needs to be
overridden be moved out into a separate profile?  Thus allowing them
to be switched on or off as appropriate.

As Brett said the inheritance rules for profiles are the same as
extending, so I guess if profiles never overrode then we'd need
different strategies here.

Mark

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


MNG-895 discussion (was: Re: [m2] resources block not merged with profiles?)

Posted by John Casey <jd...@commonjava.org>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Basically, there was a problem with the release plugin, wherein a
profile with an empty resources list was overriding the default
resources list from the super-POM. It's not really another use case for
the merge vs. override discussion, but it did highlight part of the
resource handling during profile injection, which is why I referred it
to 895. To fix this bug, I just put in a piece of code to check whether
the profile's resources list is empty (in addition to a null check)
before it overrode the model resources. I haven't addressed the override
vs. merge topic yet.

Sorry for the false alarm! :)

- -john

P.S. My personal view on this is that profiles are meant primarily for
augmentation, and secondarily for overriding...this would lead me to
conclude that resource lists should be merged wherever the resource keys
don't conflict (what's the key for a resource? probably it's dir).
That's the way I'm leaning for implementing/fixing 895, but I'd like to
solicit as much feedback as I can. -J

Mark Hobson wrote:
| [moving to dev as suggested]
|
| I see MNG-881was closed that depended on this (MNG-895) feature.  Does
| this mean we have another use-case for this?  If so, what is it
| briefly?  It'd be good to discuss whether overriding or inheriting is
| the correct behaviour for resources.
|
| Mark
|
| On 15/09/05, Brett Porter <br...@gmail.com> wrote:
|
|>DefaultModelInheritenceAssembler.
|>
|>Merged:
|>- dependencies
|>- developers and contributors
|>- plugin lists (including reports)
|>- plugin executions with matching ids
|>- plugin configuration
|>
|>Cheers,
|> Brett
|>
|>
|>On 9/15/05, Mark Hobson <ma...@gmail.com> wrote:
|>
|>>On 15/09/05, Brett Porter <br...@gmail.com> wrote:
|>>
|>>>Hi Mark,
|>>>
|>>>This is by design. For simplicity, it is intended that profiles behave
|>>>identically to inheritence, and inheritence doesn't merge resource sets.
|>>>This may or may not be the right behaviour though - but we should
|>
|>discuss in
|>
|>>>that context rather than the profile.
|>>
|>>Where's the definitive list of POM elements that get inherited or
|>>overridden?  Source or doc is fine.  Not entirely sure which way is
|>>the right one, maybe both are under different circumstances, but I'm
|>>sure you guys trashed this one out in the confluence design docs.
|>>
|>>Mark
|>>
|>
|>
|
| ---------------------------------------------------------------------
| To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
| For additional commands, e-mail: dev-help@maven.apache.org
|
|
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFDKxsgK3h2CZwO/4URAssWAJ96X/G7JGj4Vey0Tm+a13ieHhTUhwCglL1X
FyZzxoWDXMK7DVhJQn6qeAw=
=RBxg
-----END PGP SIGNATURE-----

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


Re: [m2] resources block not merged with profiles?

Posted by Mark Hobson <ma...@gmail.com>.
[moving to dev as suggested]

I see MNG-881was closed that depended on this (MNG-895) feature.  Does
this mean we have another use-case for this?  If so, what is it
briefly?  It'd be good to discuss whether overriding or inheriting is
the correct behaviour for resources.

Mark

On 15/09/05, Brett Porter <br...@gmail.com> wrote:
> DefaultModelInheritenceAssembler.
> 
> Merged:
> - dependencies
> - developers and contributors
> - plugin lists (including reports)
> - plugin executions with matching ids
> - plugin configuration
> 
> Cheers,
>  Brett
> 
> 
> On 9/15/05, Mark Hobson <ma...@gmail.com> wrote:
> > On 15/09/05, Brett Porter <br...@gmail.com> wrote:
> > > Hi Mark,
> > >
> > > This is by design. For simplicity, it is intended that profiles behave
> > > identically to inheritence, and inheritence doesn't merge resource sets.
> > > This may or may not be the right behaviour though - but we should
> discuss in
> > > that context rather than the profile.
> > 
> > Where's the definitive list of POM elements that get inherited or
> > overridden?  Source or doc is fine.  Not entirely sure which way is 
> > the right one, maybe both are under different circumstances, but I'm
> > sure you guys trashed this one out in the confluence design docs.
> > 
> > Mark
> > 
> 
>

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


Re: [m2] resources block not merged with profiles?

Posted by Brett Porter <br...@gmail.com>.
DefaultModelInheritenceAssembler.

Merged:
- dependencies
- developers and contributors
- plugin lists (including reports)
- plugin executions with matching ids
- plugin configuration

Cheers,
Brett

On 9/15/05, Mark Hobson <ma...@gmail.com> wrote:
> 
> On 15/09/05, Brett Porter <br...@gmail.com> wrote:
> > Hi Mark,
> >
> > This is by design. For simplicity, it is intended that profiles behave
> > identically to inheritence, and inheritence doesn't merge resource sets.
> > This may or may not be the right behaviour though - but we should 
> discuss in
> > that context rather than the profile.
> 
> Where's the definitive list of POM elements that get inherited or
> overridden? Source or doc is fine. Not entirely sure which way is
> the right one, maybe both are under different circumstances, but I'm
> sure you guys trashed this one out in the confluence design docs.
> 
> Mark
>

Re: [m2] resources block not merged with profiles?

Posted by Mark Hobson <ma...@gmail.com>.
On 15/09/05, Brett Porter <br...@gmail.com> wrote:
> Hi Mark,
> 
> This is by design. For simplicity, it is intended that profiles behave
> identically to inheritence, and inheritence doesn't merge resource sets.
> This may or may not be the right behaviour though - but we should discuss in
> that context rather than the profile. 

Where's the definitive list of POM elements that get inherited or
overridden?  Source or doc is fine.  Not entirely sure which way is
the right one, maybe both are under different circumstances, but I'm
sure you guys trashed this one out in the confluence design docs.

Mark

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


Re: [m2] resources block not merged with profiles?

Posted by Brett Porter <br...@gmail.com>.
Hi Mark,

This is by design. For simplicity, it is intended that profiles behave 
identically to inheritence, and inheritence doesn't merge resource sets. 
This may or may not be the right behaviour though - but we should discuss in 
that context rather than the profile.

- Brett

On 9/14/05, Mark Hobson <ma...@gmail.com> wrote:
> 
> Didn't want to file a bug if this was a conscious design decision, but
> with the following POM:
> 
> <project>
> ...
> <build>
> <resources>
> <resource>a</resource>
> </resources>
> </build>
> <profiles>
> <profile>
> ...
> <build>
> <resources>
> <resource>b</resource>
> </resources>
> </build>
> ...
> </profile>
> </profiles>
> ...
> </project>
> 
> Shouldn't the effective resources block consist of both 'a' and 'b'
> when the profile is activated? Currently 'b' overrides 'a'.
> 
> Cheers,
> 
> Mark
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
>