Ok so let me try to write a step by step:

1. you have to use lib/ext folder and not extensions.xml cause it is loaded
too late
2. you have to override the property activator as you mentionned cause
otherwise your profile is added (through plexus) in the list of activator,
set the activation to true and then property one sets it to false

To do 2 you just have to use sisu @Priority and ensure the hint is property:

@org.eclipse.sisu.Priority(1)
@Component(role = ProfileActivator.class, hint = "property")
public class AdvancedProfileActivator implements ProfileActivator {}


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<https://www.packtpub.com/application-development/java-ee-8-high-performance>


Le mar. 20 nov. 2018 à 05:56, J. Lewis Muir <jlm...@imca-cat.org> a écrit :

> On Mon, Nov 19, 2018 at 4:16 PM Romain Manni-Bucau
> <rmannibu...@gmail.com> wrote:
> > Time to push your code and an example on github to encourage help/people
> to
> > run it ;)
>
> OK, here's how to get the extension with the proof of concept code and
> install it locally:
>
> ===
> $ git clone https://github.com/imca-cat/profile-activation-advanced.git
> $ cd profile-activation-advanced
> $ git checkout lifecycle-participant-poc
> $ mvn clean install
> ===
>
> The proof of concept extension just changes the value of any profile
> property activation with a name of "paa:mvel" to the string "!false".
> It does not evaluate any MVEL expression at the moment; it's just a
> proof of concept for changing the model.  Since the system property
> "paa:mvel" is not defined, the altered property activation should
> evaluate to true, but I don't know how to get Maven to re-evaluate the
> property activations after I've changed them.
>
> And here's how to get and run a small test that uses the locally
> installed extension:
>
> ===
> $ git clone https://github.com/jlmuir/profile-activation-advanced-test.git
> $ cd profile-activation-advanced-test
> $ mvn help:active-profiles validate
> ===
>
> I'm expecting the "mvn help:active-profiles validate" command to show
> that the foo_env-development profile is active with output like
>
> ===
> The following profiles are active:
>
>  - foo_env-development (source: org.example.foo:foo:1.0.0)
> ===
>
> but it does not.  So, it seems the extension is not successfully
> changing the model (i.e., not successfully activating the
> foo_env-development profile).
>
> Thank you!
>
> Lewis
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
> For additional commands, e-mail: dev-h...@maven.apache.org
>
>

Reply via email to