You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Russ Tremain <Ru...@Sun.COM> on 2008/03/11 20:15:20 UTC

injecting pom elements from multiple parents

I have an interesting situation where we have one test project
that wants its parent to be an external project pom.

I don't want that, because it means I can't have it inherit from a common
parent we have described locally.

I.e. let X be the external pom, L be the local parent, and T be the 
test project.

What I want is:

	(X+L) -> T

What I have is:

	X  -> T
or
	L -> T

neither of which works for us.

So, is there any way to inject the contents of X into T while 
retaining L as T's parent?

I have considered the following solutions:

I.   make X the parent of my entire project.  This is undesirable 
because I would inherit
      X's dependencies in all projects, along with various other 
properties unrelated to our
      project (<developers/>, <scm/>, etc).

II.  duplicate L to L', and inherit X in L'.  This is undesirable 
because I would
      be duplicating common definitions, which is error prone and 
would require additional
      training and maintenance.

III. inherit L in L', duplicate selections from X in L', and inherit 
L' in T.  This is
      probably the most workable solution, but would cause some pain 
whenever we have to update
      X.

IV.  an automated version of III, that would create a new project 
installing L' before T
      is executed.

Has anyone else encountered this problem, or have other ideas?

tia,
-Russ

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


Re: injecting pom elements from multiple parents

Posted by Russ Tremain <Ru...@Sun.COM>.
At 10:37 PM +0100 3/11/08, simon wrote:
>On Tue, 2008-03-11 at 13:52 -0700, Russ Tremain wrote:
>> At 9:10 PM +0100 3/11/08, simon wrote:
>> >
>> >It's rather odd to want to inherit anything except (transient)
>> >dependencies from an "external" pom.
>>
>>
>> I agree - it is an odd case as well as an interesting one. :)
>>
>> >Normally, you don't want an external pom to dictate how *your* project
>> >is built, or what reports *your* project contains, etc.
>>
>> exactly.
>>
>> >What is in pom X that you want T to have?
>>
>> our test project is inheriting from a fairly complex external test framework,
>> which creates some test profiles that we are using, and declares
>> the dependencies for these profiles:
>>
>>         <artifactId>spring-osgi</artifactId>
>>         <groupId>org.springframework.osgi</groupId>
>>         <version>1.0</version>
>
>I'm no expert in this area, but it feels initially to me like project X
>is actually effectively producing N different artifacts, each with
>different dependencies.

X in this case is just a pom.  It is not producing any artifacts.

>If project X were to actually do that, then your test system T would
>have no problems; you just depend upon different flavours of X depending
>upon your own criteria.
>
>Does maven support classifiers for poms, ie can X produce a set of
>artifacts with same group/artifact but different classifiers, with a
>different pom for each classifier?

I'm not aware of how that is done, or how it would help in this case.
I think the issue is that I can only inherit from one pom, and that there
appears to be no mechanism for injecting definitions from any pom except the parent.

I.e., maven does not believe in marriage. :)

/r

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


Re: injecting pom elements from multiple parents

Posted by simon <si...@chello.at>.
On Tue, 2008-03-11 at 13:52 -0700, Russ Tremain wrote:
> At 9:10 PM +0100 3/11/08, simon wrote:
> >
> >It's rather odd to want to inherit anything except (transient)
> >dependencies from an "external" pom.
> 
> 
> I agree - it is an odd case as well as an interesting one. :)
> 
> >Normally, you don't want an external pom to dictate how *your* project
> >is built, or what reports *your* project contains, etc.
> 
> exactly.
> 
> >What is in pom X that you want T to have?
> 
> our test project is inheriting from a fairly complex external test framework,
> which creates some test profiles that we are using, and declares
> the dependencies for these profiles:
> 
>         <artifactId>spring-osgi</artifactId>
>         <groupId>org.springframework.osgi</groupId>
>         <version>1.0</version>

I'm no expert in this area, but it feels initially to me like project X
is actually effectively producing N different artifacts, each with
different dependencies.

If project X were to actually do that, then your test system T would
have no problems; you just depend upon different flavours of X depending
upon your own criteria.

Does maven support classifiers for poms, ie can X produce a set of
artifacts with same group/artifact but different classifiers, with a
different pom for each classifier?

Regards,
Simon


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


Re: injecting pom elements from multiple parents

Posted by Russ Tremain <Ru...@Sun.COM>.
At 9:10 PM +0100 3/11/08, simon wrote:
>
>It's rather odd to want to inherit anything except (transient)
>dependencies from an "external" pom.


I agree - it is an odd case as well as an interesting one. :)

>Normally, you don't want an external pom to dictate how *your* project
>is built, or what reports *your* project contains, etc.

exactly.

>What is in pom X that you want T to have?

our test project is inheriting from a fairly complex external test framework,
which creates some test profiles that we are using, and declares
the dependencies for these profiles:

        <artifactId>spring-osgi</artifactId>
        <groupId>org.springframework.osgi</groupId>
        <version>1.0</version>

/r

>On Tue, 2008-03-11 at 12:15 -0700, Russ Tremain wrote:
>> I have an interesting situation where we have one test project
>> that wants its parent to be an external project pom.
>>
>> I don't want that, because it means I can't have it inherit from a common
>> parent we have described locally.
>>
>> I.e. let X be the external pom, L be the local parent, and T be the
>> test project.
>>
>> What I want is:
>>
>>	(X+L) -> T
>>
>> What I have is:
>>
>>	X  -> T
>> or
>>	L -> T
>>
>> neither of which works for us.
>>
>> So, is there any way to inject the contents of X into T while
>> retaining L as T's parent?
>>
>> I have considered the following solutions:
>>
>> I.   make X the parent of my entire project.  This is undesirable
>> because I would inherit
>>       X's dependencies in all projects, along with various other
>> properties unrelated to our
>>       project (<developers/>, <scm/>, etc).
>>
>> II.  duplicate L to L', and inherit X in L'.  This is undesirable
>> because I would
>>       be duplicating common definitions, which is error prone and
>> would require additional
>>       training and maintenance.
>>
>> III. inherit L in L', duplicate selections from X in L', and inherit
>> L' in T.  This is
>>       probably the most workable solution, but would cause some pain
>> whenever we have to update
>>       X.
>>
>> IV.  an automated version of III, that would create a new project
>> installing L' before T
>>       is executed.
>>
>> Has anyone else encountered this problem, or have other ideas?

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


Re: injecting pom elements from multiple parents

Posted by simon <si...@chello.at>.
On Tue, 2008-03-11 at 12:15 -0700, Russ Tremain wrote:
> I have an interesting situation where we have one test project
> that wants its parent to be an external project pom.
> 
> I don't want that, because it means I can't have it inherit from a common
> parent we have described locally.
> 
> I.e. let X be the external pom, L be the local parent, and T be the 
> test project.
> 
> What I want is:
> 
> 	(X+L) -> T
> 
> What I have is:
> 
> 	X  -> T
> or
> 	L -> T
> 
> neither of which works for us.
> 
> So, is there any way to inject the contents of X into T while 
> retaining L as T's parent?
> 
> I have considered the following solutions:
> 
> I.   make X the parent of my entire project.  This is undesirable 
> because I would inherit
>       X's dependencies in all projects, along with various other 
> properties unrelated to our
>       project (<developers/>, <scm/>, etc).
> 
> II.  duplicate L to L', and inherit X in L'.  This is undesirable 
> because I would
>       be duplicating common definitions, which is error prone and 
> would require additional
>       training and maintenance.
> 
> III. inherit L in L', duplicate selections from X in L', and inherit 
> L' in T.  This is
>       probably the most workable solution, but would cause some pain 
> whenever we have to update
>       X.
> 
> IV.  an automated version of III, that would create a new project 
> installing L' before T
>       is executed.
> 
> Has anyone else encountered this problem, or have other ideas?

It's rather odd to want to inherit anything except (transient)
dependencies from an "external" pom.

Normally, you don't want an external pom to dictate how *your* project
is built, or what reports *your* project contains, etc.

What is in pom X that you want T to have?

Regards,
Simon



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