Yes, I thought about that last night, but according to the Maven 2 schema,
'false' is the default value for 'activeByDefault'.
But then again, you might be on to something, since Maven apparently thinks
that all three profiles are active (according to 'mvn
help:active-profiles'), which seems to contradict the schema's default value
of 'false'.
I going to try setting <activeByDefault>false</activeByDefault> explicitly
in the profiles.xml file tonight. I'll get back with my findings after I've
tried it.
I also remember reading somewhere that you can negate a profile activation
with e.g. 'mvn ... -P !prof1'. If this is true (I haven't tried it yet) it
would mean that all profiles are active by default(!), which is rather odd.
Carlos Alonso wrote:
>
> Hi Danny.
>
> I can guess that what you're missing is
>
> <profile>
> <id>prof1</id>
> <activation>
> <activeByDefault>false</activeByDefault>
> </activation>
> <properties>
> .
> .
> .
> </profile>
>
> So, it's up to you to specify from command line for example, the active
> profile you want.
>
>
> Danny escribió:
>> 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?
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://n2.nabble.com/Explicit-Profile-Activation-doesn%27t-work-for-me-tp834749p835720.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]