maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain Manni-Bucau <rmannibu...@gmail.com>
Subject Re: Extension does not work from .mvn/extensions.xml
Date Fri, 16 Nov 2018 06:02:07 GMT
For the marker i was thinking about "property" so your activation would be
"el:name" or anything else - idea just being not intrusive and impacting
for actual property activation.

Did you try to use an extension rewritting the model after it is read and
before it is executed with a lifecycle participant? Sounds easier to
implement since you just convert it to an active or not activation of a
built in type.
The IoC uses guice so it is notr trivial to use @priority but there are
ways to do so, that said i dont think you need checking the profile logic.

The default model builder is used when there is no IoC so shouldn't be used
here. If your activator is registered it is injected and then used in the
isActive loop if it returns true for presentInConfig call (check
DefaultProfileSelector).
This is likely where you will have to debug.

Le ven. 16 nov. 2018 00:06, J. Lewis Muir <jlmuir@imca-cat.org> a écrit :

> On Wed, Nov 14, 2018 at 3:31 PM Romain Manni-Bucau
> <rmannibucau@gmail.com> wrote:
> > You can debug using mvnDebug but i think it is cause there is already a
> > property handler -
> >
> https://github.com/apache/maven/blob/master/maven-model-builder/src/main/java/org/apache/maven/model/profile/activation/PropertyProfileActivator.java
> > - so depending the scanning order you take one or the other. Try using
> > another marker maybe or making yours higher priority probably.
>
> Hi, Romain!
>
> Thank you for your reply!
>
> What do you mean by "using another marker"?
>
> How can I make mine have higher priority?
>
> I looked at
>
>
> http://codehaus-plexus.github.io/plexus-containers/plexus-component-annotations/apidocs/
>
> and the Component annotation has a number of elements, but none of
> them look like they would let me assign a priority (e.g., an element
> named "priority").  I also don't see an annotation that looks like it
> would let me assign a priority (e.g., an annotation named "Priority").
>
> The closest I could find to the concept of a priority was a Stack
> Overflow answer
>
>   https://stackoverflow.com/a/41970497
>
> where the author talks about a solution which I think refers to this commit
>
>
> https://github.com/Code-House/maven-osgi-resolver/commit/e0b9797657d90eb35a8a166efbf3e01c09fd4189
>
> where he adds a dependency on org.eclipse.sisu:org.eclipse.sisu.inject
> and adds a Priority annotation
>
>
> http://www.eclipse.org/sisu/docs/api/org.eclipse.sisu.inject/reference/org/eclipse/sisu/Priority.html
>
> However, in the very next commit, the author removes the Priority
> annotation believing it to be unnecessary
>
>
> https://github.com/Code-House/maven-osgi-resolver/commit/67e3b31d18d1efb0b8f279a1bbacfa39b88d3236
>
> I understand Sisu to be this project
>
>   http://www.eclipse.org/sisu/
>
> but I don't know much else about it.
>
> I'm also a little concerned with what I see in DefaultModelBuilderFactory
>
>
> https://github.com/apache/maven/blob/master/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilderFactory.java
>
> in its newProfileActivators method: it creates an instance of
> PropertyProfileActivator which would seem to bypass any injection
> (including that of my AdvancedProfileActivator).  The class comment
> says, though,
>
>   This class is only meant as a utility for developers that want to
>   employ the model builder outside of the Maven build system, Maven
>   plugins should always acquire model builder instances via dependency
>   injection.
>
> So maybe I don't have to worry about it?
>
> Thanks!
>
> Lewis
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message