Sounds like a reasonable profile activation method. File a JIRA
Enhancement request.

Wayne

On 4/7/06, John Didion <[EMAIL PROTECTED]> wrote:
> That would be a lovely solution...unfortunately the property activation
> refers to system properties (i.e. specified on the command line), not
> project properties.
>
> I think you're right about packaging. It would be great to have a
> <packaging> profile activation.
>
> > -----Original Message-----
> > From: Tim Kettler [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, April 06, 2006 10:51 PM
> > To: Maven Users List
> > Subject: Re: Can I activate a profile based on module type?
> >
> > Hi,
> >
> > I never tried this but I think this could/should work:
> >
> > 1. You define the profiles in your parent pom like this
> >
> > <profiles>
> >    <profile>
> >      <id>library</id>
> >      <activation>
> >        <property>
> >          <name>moduletype</name>
> >          <value>jar</value>
> >        </property>
> >      </activation>
> >      ...
> >    </profile>
> >
> >    <profile>
> >      <id>webapp</id>
> >      <activation>
> >        <property>
> >          <name>moduletype</name>
> >          <value>war</value>
> >        </property>
> >      </activation>
> >      ...
> >    </profile>
> > </profiles>
> >
> > 2. In your modules you then define the property as needed
> >
> > <properties>
> >    <moduletype>lib</moduletype>
> > </properties>
> >
> > The most elegant solution would be to not use a custom defined
> property at
> > all but the
> > vaule of the <packaging/> element of the module poms but I don't know
> if
> > the content is
> > made available as a property.
> >
> > -Tim
> >
> > John Didion schrieb:
> > > I have a project with several different types of modules - some are
> > > libraries (stand-alone jars), some are wars, some are executables
> (jars
> > > plus some extra plugins to generate batch files and create an
> assembly).
> > > I would like to put the configuration for all these different
> project
> > > types in to my top-level pom, and then have each module activate
> only
> > > the plugin configurations that apply to its type. Profiles seem a
> > > natural way to do this, but I can't find any way to explicitly
> activate
> > > them from a module.
> > >
> > > Using the activeProfiles element in settings.xml doesn't make sense
> > > since the profile I want to activate will differ depending on the
> > > module. I tried using a profiles.xml and setting the activeProfiles
> > > there, but unfortunately that only applies to the profiles defined
> in
> > > profiles.xml.
> > >
> > > Is there another way to do what I want?
> > >
> > > Here's an example:
> > >
> > > pom.xml
> > > -------------
> > > <project>
> > >
> > >   <groupId>test</groupId>
> > >   <artifactId>parent</artifactId>
> > >
> > >   <profile>
> > >     <id>library</id>
> > >     <pluginManagement>
> > >       <plugins>
> > >         <plugin>
> > >           <groupId>foo</groupId>
> > >           <artifactId>foo</artifactId>
> > >           <configuration>
> > >               ...
> > >            </configuration>
> > >         </plugin>
> > >       </plugins>
> > >     </pluginManagement>
> > >   </profile>
> > >
> > >   <profile>
> > >     <id>webapp</id>
> > >     <pluginManagement>
> > >       <plugins>
> > >         <plugin>
> > >           <groupId>foo</groupId>
> > >           <artifactId>foo</artifactId>
> > >           <configuration>
> > >               ... (different than the library profile's
> configuration)
> > >            </configuration>
> > >         </plugin>
> > >       </plugins>
> > >     </pluginManagement>
> > >   </profile>
> > >
> > > </project>
> > >
> > > child/pom.xml
> > > ---------------------
> > > <project>
> > >   <parent>
> > >     <groupId>test</groupId>
> > >     <artifactId>parent</artifactId>
> > >   </parent>
> > >   <groupId>test</groupId>
> > >   <artifactId>child</artifactId>
> > >
> > >   ...what do I do here to activate the library profile?...
> > > </project>
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to