But try it with a profiles.xml file; for example, if I create a project with 
the app-fuse archetype:

mvn \
   archetype:create \
   -DarchetypeGroupId=org.appfuse.archetypes \
   -DarchetypeArtifactId=appfuse-modular-spring \
   -DremoteRepositories=http://static.appfuse.org/releases \
   -DgroupId=com.mycompany.app \
   -DartifactId=myproject

Then go into myproject and create the following profiles.xml file:

<?xml version="1.0"?>
<profilesXml
   xmlns="http://maven.apache.org/xsd/profiles-1.0.0";
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
   xsi:schemaLocation="http://maven.apache.org/xsd/profiles-1.0.0.xsd";>

   <profiles>
       <profile>
           <id>profile1</id>

           <activation>
               <activeByDefault>false</activeByDefault>
           </activation>
       </profile>
   </profiles>
</profilesXml>

Then notice that profile1 is only active for the parent; not the children.

$ mvn help:active-profiles -Pprofile1
[INFO] Scanning for projects...
[INFO] Reactor build order:
[INFO]   AppFuse Modular Application
[INFO]   AppFuse Modular Application - Core
[INFO]   AppFuse Modular Application - Web (Spring MVC)
[INFO] Searching repository for plugin with prefix: 'help'.
[INFO] ------------------------------------------------------------------------
[INFO] Building AppFuse Modular Application
[INFO]    task-segment: [help:active-profiles] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [help:active-profiles]
[INFO]
Active Profiles for Project 'com.mycompany.app:myproject:pom:1.0-SNAPSHOT':

The following profiles are active:

- profile1 (source: profiles.xml)



Active Profiles for Project 'com.mycompany.app:myproject-core:jar:1.0-SNAPSHOT':

There are no active profiles.



Active Profiles for Project 
'com.mycompany.app:myproject-webapp:war:1.0-SNAPSHOT':

The following profiles are active:

- integration-test (source: pom)



[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4 seconds
[INFO] Finished at: Wed Mar 11 10:04:27 PST 2009
[INFO] Final Memory: 5M/11M
[INFO] ------------------------------------------------------------------------

Likewise, if you go into a child module:

$ cd web
$ mvn help:active-profiles -Pprofile1
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'help'.
[INFO] ------------------------------------------------------------------------
[INFO] Building AppFuse Modular Application - Web (Spring MVC)
[INFO]    task-segment: [help:active-profiles] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [help:active-profiles]
[INFO]
Active Profiles for Project 
'com.mycompany.app:myproject-webapp:war:1.0-SNAPSHOT':

The following profiles are active:

- integration-test (source: pom)



[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4 seconds
[INFO] Finished at: Wed Mar 11 10:05:29 PST 2009
[INFO] Final Memory: 5M/11M
[INFO] ------------------------------------------------------------------------



Gabriele Columbro wrote:
That is not correct,
if I have a project structure like this:

A
    |    pom.xml
     --- B
          | pom.xml


And I define the profile "profile1" in A/pom.xml when running :

B myuser$ mvn help:active-profiles -Pprofile1

[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'help'.
[INFO]
------------------------------------------------------------------------
[INFO] Building Project B
[INFO]    task-segment: [help:active-profiles] (aggregator-style)
[INFO]
------------------------------------------------------------------------
[INFO] [help:active-profiles]
[INFO]
Active Profiles for Project 'com.mycompany:b:jar:0.9.0-SNAPSHOT':

The following profiles are active:

 - profile1 (source: pom)


For more info [1]  and [2] can also help.

HTH,
Gab


[1]
http://maven.apache.org/guides/introduction/introduction-to-profiles.html
[2]
http://mindthegab.com/2008/12/02/howto-give-your-multimodule-maven-build-subprojectenvironment-specific-behavior/

2009/3/11 Roman Kournjaev <[email protected]>

Hi All

I have done a little search on the net , and understood from it that a
profile defined in the parent pom cant be explicitly invoked from when
running the child pom.

It just sound so unbelivable to me! So I just wanted to hear it from you
guys too.

Thanks in Advance.
Roman





---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to