I know there are some sensible limitations to profiles...
see
http://maven.apache.org/guides/introduction/introduction-to-profiles.html
applicable section :
*
Which areas of a POM can be customized by each type of profile? Why?*
hope that helps a bit...
On Feb 12, 2008 10:36 PM, Amshoff Christoph, Köln <[EMAIL PROTECTED]>
wrote:
> Hi all.
>
> I am having troubles with profiles in a multi-module environment.
>
> Say there is a project "father" defining multiple modules in its POM like
> this:
>
> <modules>
> <module>son1</module>
> <module>son2</module>
> </modules>
>
>
> Additionally, there is a section defining some profiles for different
> environments in the father's POM:
>
> <profiles>
> ....
> <profile>
> <id>env-nb</id>
> <activation>
> <property>
> <name>env</name>
> <value>nb</value>
> </property>
> </activation>
> <properties>
> <path.db2jar>somePath</path.db2jar>
> </properties>
> </profile>
>
> <profile>
> <id>db2</id>
> <activation>
> <property>
> <name>path.db2jar</name>
> </property>
> </activation>
> <dependencies>
> <dependency>
> <groupId>db2</groupId>
> <artifactId>db2</artifactId>
> <version>8.2</version>
> <scope>system</scope>
> <systemPath>${path.db2jar}</systemPath>
> </dependency>
> </dependencies>
> </profile>
> </profiles>
>
>
> The first profile (used for nightly builds) is triggered by specifying
> -Denv=nb on the command line; the second profile (adding a dependency to DB2
> related JAR file) is activated when the variable path.db2jar is set.
>
> Now, when I look at the effective POM for "father" project with -Denv=nb
> command line option given, everything is fine: the property "path.db2jar"
> is defined and the additional dependency is added.
>
> I understand that profiles are not inherited from the parent, but only the
> effect they have on the POM.
>
> However, for all aggregated projects like son1, son2 etc., the property is
> set (inherited) correctly, but NOT the dependency! I would have expected to
> see both the property and the dependency active in effective POM of all
> childs... so... why isn't that the case? BTW, yes, the child POM do
> reference the father's POM as parent.
>
> Any ideas? Help is greatly appreciated!
>
> Thanks,
> Christoph.
>
>