Thanks for this detailled reply. I'll have to find an alternative to profiles. Ability to activate parent-POM profiles from a POM would be really nice as it would enable pulling up lot's of common configuration to corporate POMs.
For now, I'll use an archetype to add all the profiles to the generated project POM with activation based on <activeByDefault>, so that projects can easily enable/disable some configuration. Nico. 2007/6/3, John Casey <[EMAIL PROTECTED]>:
Unfortunately, this doesn't work in Maven 2.0.x. The reason is that the profile activator actually uses System.getProperty( "project.target.jre" ), not project.getProperties ().getProperty( "project.target.jre" ). It's actually a fairly involved process to check the POM for properties during profile activation (you probably wouldn't think so...). I've added the technical ability to do this in Maven trunk (2.1.x), but it still requires a custom profile activator. If you look at the c-builds code in the native-mojo project: http://svn.codehaus.org/native-mojo/c-builds/trunk you should see a directory called: plugins/cbuild-profile-activators This contains an example of precisely the type of profile activation you're trying to accomplish, but it only works on Maven trunk (which is currently pre-alpha). Sorry for any confusion. -john On May 28, 2007, at 5:03 AM, nicolas de loof wrote: > Hello, > > I'd like to have a set of profiles in my corporate parent POM for > various > maven usage. To enable them depending on projects I'd like to set a > <property> in the project POM to enable the profile : > > example : > - corporate parent pom : > > <profile> > <id>Java5</id> > <activation> > <property> > <name>project.target.jre</name> > <value>java5</value> > </property> > </activation> > <properties> > <maven.compile.source>1.5</maven.compile.source> > <maven.compile.target>1.5</maven.compile.target> > ... > > - project POM : > > <properties> > <project.target.jre>java5</project.target.jre> > </properties> > > > This doesn't work as I expected. Is there any way to enable a > profile in > parent POM from a child POM ? > > Nico. --- John Casey Committer and PMC Member, Apache Maven mail: jdcasey at commonjava dot org blog: http://www.ejlife.net/blogs/john