maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "J. Lewis Muir" <jlm...@imca-cat.org>
Subject Re: Extension does not work from .mvn/extensions.xml
Date Fri, 16 Nov 2018 23:09:40 GMT
On Fri, Nov 16, 2018 at 3:35 PM Romain Manni-Bucau
<rmannibucau@gmail.com> wrote:
> I didnt find in the code where the hint matches, just saw a chain so should
> work if i didnt miss a later filtering.

Where in the code is that?

> That said my naming advise was for
> the pom content more than the code (to not interpret default property tag).

I see.  But if I add a new tag, then the POM wouldn't validate against
the DTD, right?  That seems like an undesirable path to take, no?

And even if I did change the POM content to have, let's say, an
advancedProperty element under the XPath
/project/profiles/profile/activation, what object in the model would
be created when Maven reads the POM?  It seems to me that it won't
know how to create an object for this part of the POM in
MavenXpp3Reader, so I don't understand how it would work.  I would
need it to be able to create an AdvancedActivationProperty, but I
don't see a way to make it able to do that.

> > Am I anywhere near understanding what you're suggesting?
>
> You can mutate this model, this is all the trick ;)

So, the hack I outlined is what you were thinking?  I don't see how to
do it any other way.

> > But my problem is getting my activator to be injected instead of the
> > regular one.  I think that's where the @Priority annotation comes in.
> > But I think you're suggesting the lifecycle participant approach would
> > be easier, so I'm trying that now.
> >
>
> Not instead but also. Instead of 3 impl you will get 4.

I see.  I guess I don't know where to hook into the model, then.  I
can't find anything in the model that implements the is-active
computation for a Profile or Activation, so I don't see how to hook
into it other than mutating the model with the hack I previously
proposed which was to evaluate the MVEL expression and replace the
ActivationProperty with one with a specially constructed name and
value that would always evaluate to the just computed result of the
MVEL expression.

So, in the approach where I have 4 implementations, how do I get Maven
to use my AdvancedProfileActivator?  I assumed this was done based on
the Component annotation hint element, and I thought the hint had to
match the element under the activation element in the POM (e.g.,
<activation><property>...</property></activation> means the hint for
Maven's PropertyProfileActivator must be "property", which it is).
So, for <activation><advancedProperty>...</advancedProperty></activation>,
the hint for my AdvancedProfileActivator must be "advancedProperty".
If that's right, then that makes sense to me.  But I still don't know
how to get Maven to create an instance of AdvancedActivationProperty
in the model when it reads the POM.

Sorry to not be understanding things.  Thanks for your help!  I really
appreciate it!

Lewis

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


Mime
View raw message