Maven 2 & 3

Profiles in profiles.xml not activated properly

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Duplicate
  • Affects Version/s: 2.0.9
  • Fix Version/s: None
  • Component/s: Profiles
  • Labels:
    None
  • Environment:
    Windows XP Professional
  • Complexity:
    Intermediate
  • Number of attachments :
    0

Description

I created a profiles.xml file with three profiles in it as shown below. When I execute a Maven command like:

>mvn -f <path-to-basedir>\pom.xml -PconwebDev ...

the properties defined by profile conwebFinal are used. I shuffled the profiles around in the file and whichever one was defined last was the one whose values took effect. It seems as if all profiles are being activated and the last one wins.

When I put these same profiles in settings.xml or inside the main pom.xml, everything works properly.

Here are the profiles:

<profiles>
<!-- conweb Project-specific profiles -->
<profile>
<id>conwebDev</id>
<properties>
<app.properties>conweb.properties</app.properties>
<app.version.qualifier>DEV</app.version.qualifier>
</properties>
</profile>

<profile>
<id>conwebTest</id>
<properties>
<app.properties>conweb.properties</app.properties>
<app.version.qualifier>TEST</app.version.qualifier>
</properties>
</profile>

<profile>
<id>conwebFinal</id>
<properties>
<app.properties>conweb.properties</app.properties>
<app.version.qualifier>FINAL</app.version.qualifier>
</properties>
</profile>
</profiles>

Issue Links

Activity

Hide
Alejandro Scandroli added a comment -

I can confirm the issue and it's very easy to test just type:

mvn help:active-profiles -P conwebDev

and you will see that all the profiles in the profiles.xml are active.

Show
Alejandro Scandroli added a comment - I can confirm the issue and it's very easy to test just type: mvn help:active-profiles -P conwebDev and you will see that all the profiles in the profiles.xml are active.

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: