hallo
glad to help :)
i have no mixture of the profiles neeeded for the builds within
settings.xml (so everyone who gets the pom can built it). you dont have
a profiles.xml too?
i have put everything in pom.xml profiles:
<profiles>
<profile>
<id>local</id>
<properties>
<env>DEV</env>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<filters>
</filters>
</build>
</profile>
<profile>
<id>test</id>
<properties>
<env>TEST</env>
</properties>
<build>
<filters>
</filters>
</build>
</profile>
...
i have never encountered profiles beeing active where they where not
supposed to, give 'mvn help:effective-settings' and 'mvn
help:effective-pom' and 'mvn help:active-profiles' a try. it may tell
you what maven does.
i do not have the war-plugin within the profile section. i've put it
within the normal built section:
<profiles>
</profiles>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>war</goal>
</goals>
<configuration>
...
</plugins>
</plugins>
</build>
apart from that i do not see any differences :/
regards
ossi
Philippe Le Marchand schrieb:
Hi ossi, thank you very much for your reaction, I just figured it out
searching in Nabble's archives, so I prepared myself to ask for help
on what I needed instead of how to inherit profiles to accomplish it
:-)
So the idea is to:
- access the filter properties file corresponding to the target environment
- override waven war plugin behaviour for local deployment only (that
is setting another webapp directory than the Maven's default
target/artifactId)
- activate the local profile by default if none is provided through
the CLI (with -P profileId).
I've got several filter properties files under parent/src/main/filters:
- filter-local.properties
- filter-dev.properties
and I would like the path to the deploy folder of my AS (JBoss) user dependent.
Here are more relevant extracts:
*** parent POM ***
<build>
<filters>
<filter>${parent.relativePath}/src/main/filters/filter-${env}.properties</filter>
</filters>
</build>
<profiles>
<profile>
<id>local</id>
<properties>
<env>local</env>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webappDirectory>${appserver.deploy}/${build.finalName}.war</webappDirectory>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
<profile>
<id>dev</id>
<properties>
<env>dev</env>
</properties>
</profile>
</profiles>
*** moduleN POM ***
<build>
<resources>
<resource>
<filtering>true</filtering>
<directory>src/main/resources</directory>
</resource>
</resources>
</build>
*** user's settings.xml ***
<profiles>
<profile>
<id>local</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<appserver.deploy>/path/to/deploy/folder</appserver.deploy>
</properties>
</profile>
</profiles>
When launching the CLI 'mvn install' in a module or the parent,
everything works fine, but with 'mvn install -P dev' it seems that the
'local' profile (activeByDefault) is not deactivated.
The 'env' property is ok, as the right filter properties file is
chosen, but it still assemble the webapp under 'appserver.deploy',
which is not asked (see pluginManagement under 'local' profile) and
the property itself shouldn't be set (see user's settings.xml).
I've found the following interesting issue in Jira:
http://jira.codehaus.org/browse/MNG-2136
But I still don't understand why the 'local' profile is not deactivated.
If not possible, should there be another way to meet my needs?
Thanks,
Philippe
On 9/6/07, ossi petz <[EMAIL PROTECTED]> wrote:
hallo
the profiles are not inherited to child modules, but the effects are. so
the child will not show the profile as active but it will work nontheless.
see: http://www.nabble.com/Profile-inheritance-tf2953156s177.html#a8259757
for a better explanation
regards
ossi
Philippe Le Marchand schrieb:
Hi all,
This is my first post, necessary as I can't find an answer in the archives ;-)
I'm trying to define profiles, mainly for filtering purpose, on
different modules of my project: local, test and prod, for instance.
I configured my project and modules with inheritance and aggregation,
which is working fine except that profiles defined in the parent's POM
doesn't seem to be inherited by its modules.
Here is an extract from the parent's POM:
<groupId>parent-groupId</groupId>
<artifactId>parent-artifactId</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<modules>
<module>../module1</module>
<module>../module2</module>
</modules>
<profiles>
<profile>
<id>local</id>
<properties>
<env>local</env>
</properties>
</profile>
<profile>
<id>dev</id>
<properties>
<env>dev</env>
</properties>
</profile>
</profiles>
Here is an extract from the module1's POM:
<parent>
<groupId>parent-groupId</groupId>
<artifactId>parent-artifactId</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<groupId>module1-groupId</groupId>
<artifactId>module1-artifactId</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
The module2's POM is the same with 'module2' as ids and 'war' as packaging.
When launching the following CLI in the parent's base dir :
mvn help:active-profiles -P local
I see :
Active Profiles for Project 'parent-groupId:parent-artifactId:pom:1.0-SNAPSHOT':
The following profiles are active:
- local (source: pom)
- alwaysActiveProfile (source: settings.xml)
Active Profiles for Project
'module1-groupId:module1-artifactId:jar:1.0-SNAPSHOT':
The following profiles are active:
- alwaysActiveProfile (source: settings.xml)
Active Profiles for Project
'module2-groupId:module2-artifactId:war:1.0-SNAPSHOT':
The following profiles are active:
- alwaysActiveProfile (source: settings.xml)
Same result with '-P dev' in the CLI, and same problem running the CLI
in a module's base dir.
How can I have 'local' or 'dev' profile active in the modules?
Thanks for your help,
Philippe
---------------------------------------------------------------------
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]