Hi!
It seems that the profile activation isn't working for me, even though I
explicitly tell Maven to activate it with the -P option.
Background:
I have an external profile file (profiles.xml) that has some properties in
each profile section:
<profiles>
<profile>
<id>prof1</id>
<properties>
<MyProp>X</MyProc>
</properties>
</profile>
<profile>
<id>prof2</id>
<properties>
<MyProp>Y</MyProc>
</properties>
</profile>
<profile>
<id>prof3</id>
<properties>
<MyProp>Z</MyProc>
</properties>
</profile>
</profiles>
The resource file that I want to filter contains:
# app.properties
...
property=${MyProp}
...
I've already turned resource filtering on in the top-level POM.
If I do 'mvn help:effective-pom -Pprof1' (I tried with and without a space
between '-P' and 'prof1', to no effect), sure enough, the filtering seems to
be working:
<project>
...
<properties>
<MyProp>Z</MyProp>
</properties>
</project>
I can even confirm this by looking in the processes resource file:
# app.properties
...
property=Z
...
For some reason I don't understand, it doesn't matter what profile I speficy
with the -P option, Maven will consistently use the last profile (which sets
the value 'Z', as described above). When I try to use the command 'mvn
help:active-profiles' it also states that it has understood that there are 3
profiles:
(output from mvn help:active-profiles)
Active Profiles for Project '...':
The following profiles are active:
- prof1 (source: profiles.xml)
- prof2 (source: profiles.xml)
- prof3 (source: profiles.xml)
...
What am I doing wrong? I suppose I could use the <activation>-tags (I have
none specified at the moment because I'm assuming that the -P option takes
care of that(?)) and activate a profile with 'mvn -Dprof1 ...', but that
shouldn't be necessary, because the -P option should work, right?
--
View this message in context:
http://n2.nabble.com/Explicit-Profile-Activation-doesn%27t-work-for-me-tp834749p834749.html
Sent from the maven users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]