You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Ralph Goers <Ra...@dslextreme.com> on 2006/10/24 04:20:29 UTC

Re: Customizing Maven

John,

I've not looked at the Plexus code, but it reminds me a bit of Avalon.  
It seems like what you are trying to achieve should be easily doable 
except that I am noticing that all the components.xml files are bound to 
their components inside their respective jars. I'm not sure why that is, 
but if it were possible to supply a directory where override definitions 
could be placed  (ideally, just for specific roles) then Eclipse (or 
better yet, IntelliJ ;-)) could just provide its own implementation of 
these classes.

Ralph

John Casey wrote:
> Hi all,
>
> I wanted to start talking about a new feature for Maven 2.1 that I think
> will prove to be very powerful. I'd like Maven 2.1 to allow 
> customization of
> the components used in any particular role of the build. it would allow
> developers to specify which ArtifactResolver implementation(s) they 
> wanted
> to use when building their project, for example.
>
> So, if you were building Eclipse applications, you might have a stack of
> resolvers that implemented the following artifact resolution strategy:
>
> 1. Check the Maven local repository
> 2. Check the local Eclipse instance for a matching installed plugin
> 3. Check the Maven remote repositories specified in the project
> 4. Check the Eclipse update-sites specified in the project
> 5. Fail
>
> As another concrete example, custom components could be used to build
> MavenProject instances for a multimodule build directly from Eclipse
> .project and .classpath files by swapping in an alternative
> MavenProjectBuilder. Or, by swapping in a MavenProjectBuilder instance 
> that
> allowed stacking similar to the above resolution example, you could:
>
> 1. Try building from a POM
> 2. Try building from Eclipse .project/.classpath
> 3. Try building from Netbeans project files
>
> etc. etc.
>
> I think it's important that projects are able to specify this sort of
> customization, and if so, that they are able to specify it in a portable
> way. Having said that, per-project customization raises some sticky
> questions:
>
> * If you build a multimodule project, and two or more of those modules
> specify custom components, which one wins?
> * Do we provide a "clean" Maven environment for each project building 
> in a
> multimodule build instead of the above? This could be expensive.
> * When we resolve dependencies, do we detect and engage their own
> customizations when we're resolving transitive dependencies? What about
> other aspects of the build that might allow customization?
>
> These are definitely hard problems to solve (and more importantly, to 
> solve
> intuitively). Nevertheless, I think we could make a start by limiting the
> use of customizations in multimodule builds, in parent-child hierarchies,
> and in terms of the types of customizations are allowed...at least
> initially. We already have a prototypical implementation of this in Maven
> 2.0.4 by way of build extensions - the trouble is, they don't allow
> replacement of components which have a long lifecycle and are already
> initialized when the project instance is loaded. Determining when this
> limitation comes into effect can be pretty daunting and unpredictable,
> leaving the feature nearly useless except in simple cases.
>
> I've been thinking about it in the back of my head for a long time 
> now, and
> the best I've come up with - without modifying the POM syntax, which 
> may be
> necessary in the end - is to attach a plexus application.xml to the 
> project
> artifact when it's installed or deployed...then, lock down any 
> possibility
> for inconsistency by aggressively detecting multiple application.xml 
> files
> in a single build. Based on detection of duplicate application.xml 
> files, we
> could provide an option like we do for checksums: warn or fail. If we 
> warn,
> then we would ignore any but the first application.xml we encounter.
>
> One of the things that makes this so difficult is the same thing that 
> makes
> so much of Maven complex and difficult - the fact that we have to analyze
> multiple layers/dimensions of influence whenever we talk about POMs or
> projects.
>
> 1. The current POM
> 2. The ancestry
> 3. The other POMs in the reactor
> 4. Dependency POMs
> 5. Plugin POMs
>
> It is complex to calculate the effects of component customization when it
> could come from basically any of these POM/project sources, just the same
> way it's complex to calculate the influence and activation of build
> profiles, for example. So, if we could generalize a pattern for 
> dealing with
> this sort of thing, or even better, implement some strategy for 
> factoring in
> their respective influences, that would be excellent as well.
>
>
> Does anyone have any thoughts on any of this?
>
> Cheers,
>
> John
>

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


Re: Customizing Maven

Posted by Jason van Zyl <ja...@maven.org>.
On 23 Oct 06, at 10:20 PM 23 Oct 06, Ralph Goers wrote:

> John,
>
> I've not looked at the Plexus code, but it reminds me a bit of Avalon.

The first version of Plexus was an Avalon container and it still has  
an Avalon personality i.e. you can run Avalon component in Plexus.

> It seems like what you are trying to achieve should be easily  
> doable except that I am noticing that all the components.xml files  
> are bound to their components inside their respective jars. I'm not  
> sure why that is

It's so that components can be discovered on the classpath and  
automatically wired into a component assembly.

> , but if it were possible to supply a directory where override  
> definitions could be placed  (ideally, just for specific roles)  
> then Eclipse (or better yet, IntelliJ ;-)) could just provide its  
> own implementation of these classes.
>

This is also possible and is done with the Plexus App Server (much  
like Phoenix) where the apps configuration can override anything  
found in the components.xml files buried in the JARs.

Thanks,

Jason.



> Ralph
>
> John Casey wrote:
>> Hi all,
>>
>> I wanted to start talking about a new feature for Maven 2.1 that I  
>> think
>> will prove to be very powerful. I'd like Maven 2.1 to allow  
>> customization of
>> the components used in any particular role of the build. it would  
>> allow
>> developers to specify which ArtifactResolver implementation(s)  
>> they wanted
>> to use when building their project, for example.
>>
>> So, if you were building Eclipse applications, you might have a  
>> stack of
>> resolvers that implemented the following artifact resolution  
>> strategy:
>>
>> 1. Check the Maven local repository
>> 2. Check the local Eclipse instance for a matching installed plugin
>> 3. Check the Maven remote repositories specified in the project
>> 4. Check the Eclipse update-sites specified in the project
>> 5. Fail
>>
>> As another concrete example, custom components could be used to build
>> MavenProject instances for a multimodule build directly from Eclipse
>> .project and .classpath files by swapping in an alternative
>> MavenProjectBuilder. Or, by swapping in a MavenProjectBuilder  
>> instance that
>> allowed stacking similar to the above resolution example, you could:
>>
>> 1. Try building from a POM
>> 2. Try building from Eclipse .project/.classpath
>> 3. Try building from Netbeans project files
>>
>> etc. etc.
>>
>> I think it's important that projects are able to specify this sort of
>> customization, and if so, that they are able to specify it in a  
>> portable
>> way. Having said that, per-project customization raises some sticky
>> questions:
>>
>> * If you build a multimodule project, and two or more of those  
>> modules
>> specify custom components, which one wins?
>> * Do we provide a "clean" Maven environment for each project  
>> building in a
>> multimodule build instead of the above? This could be expensive.
>> * When we resolve dependencies, do we detect and engage their own
>> customizations when we're resolving transitive dependencies? What  
>> about
>> other aspects of the build that might allow customization?
>>
>> These are definitely hard problems to solve (and more importantly,  
>> to solve
>> intuitively). Nevertheless, I think we could make a start by  
>> limiting the
>> use of customizations in multimodule builds, in parent-child  
>> hierarchies,
>> and in terms of the types of customizations are allowed...at least
>> initially. We already have a prototypical implementation of this  
>> in Maven
>> 2.0.4 by way of build extensions - the trouble is, they don't allow
>> replacement of components which have a long lifecycle and are already
>> initialized when the project instance is loaded. Determining when  
>> this
>> limitation comes into effect can be pretty daunting and  
>> unpredictable,
>> leaving the feature nearly useless except in simple cases.
>>
>> I've been thinking about it in the back of my head for a long time  
>> now, and
>> the best I've come up with - without modifying the POM syntax,  
>> which may be
>> necessary in the end - is to attach a plexus application.xml to  
>> the project
>> artifact when it's installed or deployed...then, lock down any  
>> possibility
>> for inconsistency by aggressively detecting multiple  
>> application.xml files
>> in a single build. Based on detection of duplicate application.xml  
>> files, we
>> could provide an option like we do for checksums: warn or fail. If  
>> we warn,
>> then we would ignore any but the first application.xml we encounter.
>>
>> One of the things that makes this so difficult is the same thing  
>> that makes
>> so much of Maven complex and difficult - the fact that we have to  
>> analyze
>> multiple layers/dimensions of influence whenever we talk about  
>> POMs or
>> projects.
>>
>> 1. The current POM
>> 2. The ancestry
>> 3. The other POMs in the reactor
>> 4. Dependency POMs
>> 5. Plugin POMs
>>
>> It is complex to calculate the effects of component customization  
>> when it
>> could come from basically any of these POM/project sources, just  
>> the same
>> way it's complex to calculate the influence and activation of build
>> profiles, for example. So, if we could generalize a pattern for  
>> dealing with
>> this sort of thing, or even better, implement some strategy for  
>> factoring in
>> their respective influences, that would be excellent as well.
>>
>>
>> Does anyone have any thoughts on any of this?
>>
>> Cheers,
>>
>> John
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>


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