You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by John Fallows <jo...@gmail.com> on 2005/10/05 20:56:48 UTC

[m2] pom.xml syntax

Is it possible to customize the syntax of pom.xml without impacting
the rest of the Maven2?

For example, could one provide a CustomMavenProjectBuilder and then
register it as a Plexus MavenProjectBuilder component?

How would Maven2 decide which implementation to use, if both the
Default and Custom implementations were registered on the M2
classpath?

Kind Regards,
John Fallows.

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


Re: [m2] pom.xml syntax

Posted by Arik Kfir <ar...@gmail.com>.
I love maven(2) as it is - but I guess one could come up with a scenario
such as database-stored POMs or something of the sort...

But I agree this is definitely way out of the main-stream... ;-)

On 10/6/05, Jason van Zyl <ja...@maven.org> wrote:
>
> On Wed, 2005-10-05 at 18:56 +0000, John Fallows wrote:
> > Is it possible to customize the syntax of pom.xml without impacting
> > the rest of the Maven2?
>
> In theory yes, but would we want to allow that I don't know. What do you
> want to customize? Is is something generally useful that might be
> incorporated into Maven itself?
>
> > For example, could one provide a CustomMavenProjectBuilder and then
> > register it as a Plexus MavenProjectBuilder component?
>
> Yes.
>
> > How would Maven2 decide which implementation to use, if both the
> > Default and Custom implementations were registered on the M2
> > classpath?
>
> Plexus allows multiple implementations of a component which you select
> by a component id or role hint as we call it in Plexus. You would make
> your new component and would have to change the components.xml in maven-
> project and it would work but I don't know if that's something I'd like
> to see as a common occurrence.
>
> > Kind Regards,
> > John Fallows.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> --
> jvz.
>
> Jason van Zyl
> jason at maven.org <http://maven.org>
> http://maven.apache.org
>
> you are never dedicated to something you have complete confidence in.
> No one is fanatically shouting that the sun is going to rise tomorrow.
> They know it is going to rise tomorrow. When people are fanatically
> dedicated to political or religious faiths or any other kind of
> dogmas or goals, it's always because these dogmas or
> goals are in doubt.
>
> -- Robert Pirzig, Zen and the Art of Motorcycle Maintenance
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: [m2] pom.xml syntax

Posted by Jason van Zyl <ja...@maven.org>.
On Tue, 2005-10-25 at 20:54 +0000, John Fallows wrote:
> On 10/5/05, Jason van Zyl <ja...@maven.org> wrote:
> > On Wed, 2005-10-05 at 18:56 +0000, John Fallows wrote:
> > > Is it possible to customize the syntax of pom.xml without impacting
> > > the rest of the Maven2?
> >
> > In theory yes, but would we want to allow that I don't know. What do you
> > want to customize? Is is something generally useful that might be
> > incorporated into Maven itself?
> 
> Not really - it's more of an intermediate step to aid initial Maven2
> adoption for an existing build system. Over time we'll hopefully be able to
> consume pom.xml directly. We'll be sure to file any necessary enhancements
> or bugs that would otherwise prevent our migration to the standard
> pom.xmlsyntax.

You have some specific examples?

> To get this working, we'd register a custom implementation with the same
> <role>, but a different <role-hint>, say
> <role-hint>custom-syntax</role-hint>?

Yes, but there the ProjectBuilder is made up of many other components so
we might need to document something for you.

> Then we would have to directly update META-INF/plexus/components.xml to add
> that <role-hint> to the <requirements> section of whatever consumes the
> MavenProjectBuilder <role>, right?

Something we've been planning for a while in plexus is to always use a
role hint because this is one of the cases where we thought we would
only ever have one implementation so all the components that use the
project builder only pull it in by its role. So we would have to change
that everywhere to use a role+role-hint so that you could do what you
need. Or if it's just your implementation then you can just knock out
the default one we provide. Actually that would probably be easier to
start.

> Does that mean we'd need to update the following from
> maven-core-2.0.jar!/META-INF/plexus/components.xml?
> 
> <component>
> <role>org.apache.maven.Maven</role>
> <implementation>org.apache.maven.DefaultMaven</implementation>
> <requirements>
> <requirement>
> <role>org.apache.maven.project.MavenProjectBuilder</role>
> <role-hint>custom-syntax</role-hint>
> </requirement>
> <requirement>
> <role>org.apache.maven.lifecycle.LifecycleExecutor</role>
> </requirement>
> <requirement>
> <role>org.apache.maven.usability.diagnostics.ErrorDiagnostics</role>
> </requirement>
> <requirement>
> <role>org.apache.maven.execution.RuntimeInformation</role>
> </requirement>
> </requirements>
> </component>

If you just moved ours out of the way and named yours the same as ours
you could quickly try your new version. You would simply need to change
the implementation element to point to your class instead of ours. The
rest of the requires elements would remain the same as they point to the
interface.

> I was wondering if it was possible to put this in a different JAR, and leave
> maven-core-2.0.jar unchanged. This seems to imply that the <role>
> org.apache.maven.Maven</role> would need it's own <role-hint> as well. Is
> there a convenient way to get Maven2 to use a custom <role-hint> when
> discovering the <role>org.apache.maven.Maven</role> during "mvn" invocation?

You would need to knock our implementation out. The easiest way to do
this I would think is to put your implementation into maven-project and
rebuild the JAR. We haven't exposed plexus' overriding mechanism in
Maven. This allows a user configuration to override anything in the
component descriptors found inside the JARs. If you want to raise this
issue in JIRA we might be able to look at it. I think someone else asked
about a custom implementation of a component so using plexus' override
mechanism would make this a lot easier.

For anything with multiple implementations you use role hints. But we
are now thinking you'll never know when you will expand so we're moving
toward using role hints all the time and just having a default hint of
"default" in most places to make situations like this easier to deal
with.

Hope that helps. I'm in IRC if you need any more in depth help.

> Kind Regards,
> John Fallows
> 
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> > --
> > jvz.
> >
> > Jason van Zyl
> > jason at maven.org <http://maven.org>
> > http://maven.apache.org
> >
> > you are never dedicated to something you have complete confidence in.
> > No one is fanatically shouting that the sun is going to rise tomorrow.
> > They know it is going to rise tomorrow. When people are fanatically
> > dedicated to political or religious faiths or any other kind of
> > dogmas or goals, it's always because these dogmas or
> > goals are in doubt.
> >
> > -- Robert Pirzig, Zen and the Art of Motorcycle Maintenance
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
-- 
jvz.

Jason van Zyl
jason at maven.org
http://maven.apache.org

the course of true love never did run smooth ...

 -- Shakespeare


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


Re: [m2] pom.xml syntax

Posted by John Fallows <jo...@gmail.com>.
On 10/5/05, Jason van Zyl <ja...@maven.org> wrote:
> On Wed, 2005-10-05 at 18:56 +0000, John Fallows wrote:
> > Is it possible to customize the syntax of pom.xml without impacting
> > the rest of the Maven2?
>
> In theory yes, but would we want to allow that I don't know. What do you
> want to customize? Is is something generally useful that might be
> incorporated into Maven itself?

Not really - it's more of an intermediate step to aid initial Maven2
adoption for an existing build system. Over time we'll hopefully be able to
consume pom.xml directly. We'll be sure to file any necessary enhancements
or bugs that would otherwise prevent our migration to the standard
pom.xmlsyntax.

> > For example, could one provide a CustomMavenProjectBuilder and then
> > register it as a Plexus MavenProjectBuilder component?
>
> Yes.
>
> > How would Maven2 decide which implementation to use, if both the
> > Default and Custom implementations were registered on the M2
> > classpath?
>
> Plexus allows multiple implementations of a component which you select
> by a component id or role hint as we call it in Plexus. You would make
> your new component and would have to change the components.xml in maven-
> project and it would work but I don't know if that's something I'd like
> to see as a common occurrence.

Agreed 100%.

To get this working, we'd register a custom implementation with the same
<role>, but a different <role-hint>, say
<role-hint>custom-syntax</role-hint>?

Then we would have to directly update META-INF/plexus/components.xml to add
that <role-hint> to the <requirements> section of whatever consumes the
MavenProjectBuilder <role>, right?

Does that mean we'd need to update the following from
maven-core-2.0.jar!/META-INF/plexus/components.xml?

<component>
<role>org.apache.maven.Maven</role>
<implementation>org.apache.maven.DefaultMaven</implementation>
<requirements>
<requirement>
<role>org.apache.maven.project.MavenProjectBuilder</role>
<role-hint>custom-syntax</role-hint>
</requirement>
<requirement>
<role>org.apache.maven.lifecycle.LifecycleExecutor</role>
</requirement>
<requirement>
<role>org.apache.maven.usability.diagnostics.ErrorDiagnostics</role>
</requirement>
<requirement>
<role>org.apache.maven.execution.RuntimeInformation</role>
</requirement>
</requirements>
</component>

I was wondering if it was possible to put this in a different JAR, and leave
maven-core-2.0.jar unchanged. This seems to imply that the <role>
org.apache.maven.Maven</role> would need it's own <role-hint> as well. Is
there a convenient way to get Maven2 to use a custom <role-hint> when
discovering the <role>org.apache.maven.Maven</role> during "mvn" invocation?

Kind Regards,
John Fallows

> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> --
> jvz.
>
> Jason van Zyl
> jason at maven.org <http://maven.org>
> http://maven.apache.org
>
> you are never dedicated to something you have complete confidence in.
> No one is fanatically shouting that the sun is going to rise tomorrow.
> They know it is going to rise tomorrow. When people are fanatically
> dedicated to political or religious faiths or any other kind of
> dogmas or goals, it's always because these dogmas or
> goals are in doubt.
>
> -- Robert Pirzig, Zen and the Art of Motorcycle Maintenance
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: [m2] pom.xml syntax

Posted by Jason van Zyl <ja...@maven.org>.
On Wed, 2005-10-05 at 18:56 +0000, John Fallows wrote:
> Is it possible to customize the syntax of pom.xml without impacting
> the rest of the Maven2?

In theory yes, but would we want to allow that I don't know. What do you
want to customize? Is is something generally useful that might be
incorporated into Maven itself?

> For example, could one provide a CustomMavenProjectBuilder and then
> register it as a Plexus MavenProjectBuilder component?

Yes.

> How would Maven2 decide which implementation to use, if both the
> Default and Custom implementations were registered on the M2
> classpath?

Plexus allows multiple implementations of a component which you select
by a component id or role hint as we call it in Plexus. You would make
your new component and would have to change the components.xml in maven-
project and it would work but I don't know if that's something I'd like
to see as a common occurrence. 

> Kind Regards,
> John Fallows.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
-- 
jvz.

Jason van Zyl
jason at maven.org
http://maven.apache.org

you are never dedicated to something you have complete confidence in.
No one is fanatically shouting that the sun is going to rise tomorrow.
They know it is going to rise tomorrow. When people are fanatically
dedicated to political or religious faiths or any other kind of 
dogmas or goals, it's always because these dogmas or
goals are in doubt.

  -- Robert Pirzig, Zen and the Art of Motorcycle Maintenance


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