Basing profile activation on a plugins is probably not the best idea. Are these 
not based on the platform? 

Probably best to state what you require, as people who tend to conflate their 
solution with what they think is required tend to go down the wrong path.

Under what conditions exactly do you need the profile activated. Right now 
plugin configuration would be too late, but I don't think that would be the 
right way anyway. Not that we can't change this, but the clear requirements 
would be a good start :-)

On Mar 29, 2010, at 6:24 AM, Mirko Jahn wrote:

> Hey there,
> 
> I am currently in the process of defining a pom hierarchy of a hugh
> project, which was formally developed using Maven 1. As one of the
> benefits we'd like to accomplish a grouping of dependencies / features
> and configurations. On a first look profiles seemed promising, but the
> lack of runtime evaluation of properties defined in the pom.xml itself
> made it impossible to use (we can't use the settings.xml because each
> component has a different set of dependencies based on the
> capabilities and using the command line would be too much of a hazel
> and just plain awkward).
> 
> Anyway, the idea of having a profile as some sort of a mixin stuck to
> my head. So, I am currently wondering if it is possible to activate
> profiles based on a plug-in. I gave it a very basic try by doing the
> following:
> 
>    /**
>     * @parameter default-value="${project}"
>     * @required
>     */
>    private MavenProject project;
> 
>    @Override
>    public void execute()
>        throws MojoExecutionException
>    {
>        // before check
>        printActiveProfiles();
> 
>        Iterator<Profile> pIter =
> project.getModel().getProfiles().iterator(); // parent pom profiles
> ignored for now
>        ArrayList l = new ArrayList();
>        while(pIter.hasNext()){
>            Profile p = pIter.next();
>            l.add(p);
>        }
>        // set profiles active
>        project.setActiveProfiles(l);
> 
>        // after check
>        printActiveProfiles();
>    }
> 
> The code above shows that it does in fact change the project, but the
> "activated" profiles don't get used. I assume, I didn't "inject" the
> altered project set-up correctly, so I was wondering if someone has a
> clue what to do here?
> 
> My ultimate goal is to enable a set of profiles (and later generally
> include pom dependencies) based on a plug-in configuration. With this
> I would be able to define dependencies and configurations and assemble
> them on a "as needed" basis like real mixins for cross cutting
> concerns.
> 
> Cheers,
> Mirko
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
> For additional commands, e-mail: dev-h...@maven.apache.org
> 

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
----------------------------------------------------------

Reply via email to