You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Benson Margulies <bi...@gmail.com> on 2010/05/03 20:32:14 UTC

-D versus properties at top level and in profiles

We thought (my coworkers and I) that -D would win any conflict of
properties. But we seem to be experiencing something more complex when
we've got the same property in three places: -D, parent <properties>,
and profile <properties>. The command line isn't always winning.

What are we missing?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: -D versus properties at top level and in profiles

Posted by Benson Margulies <bi...@gmail.com>.
Thanks. This forced me to retrace my steps and find the real problem.

On Mon, May 3, 2010 at 3:43 PM, Kalpak Gadre <ka...@gmail.com> wrote:
> Try this,
>
> <project xmlns="http://maven.apache.org/POM/4.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/maven-v4_0_0.xsd">
> <modelVersion>4.0.0</modelVersion>
> <groupId>com.test</groupId>
> <artifactId>property</artifactId>
> <version>0.0.1-SNAPSHOT</version>
> <properties>
> <myprop>project</myprop>
> </properties>
> <profiles>
> <profile>
> <id>foo</id>
> <properties>
> <myprop>project-profile</myprop>
> </properties>
> </profile>
> </profiles>
> <build>
> <plugins>
> <plugin>
> <artifactId>maven-antrun-plugin</artifactId>
> <executions>
> <execution>
> <phase>test</phase>
> <configuration>
> <tasks>
> <echo message="Value: ${myprop}" />
> </tasks>
> </configuration>
> <goals>
> <goal>run</goal>
> </goals>
> </execution>
> </executions>
> </plugin>
> </plugins>
> </build>
> </project>
>
> Works as expected for me as of 2.2.1 -D always wins.
>
>
>> I thought -D would win always too.
>>
>> On Mon, May 3, 2010 at 1:32 PM, Benson Margulies<bi...@gmail.com>
>>  wrote:
>>
>>>
>>> We thought (my coworkers and I) that -D would win any conflict of
>>> properties. But we seem to be experiencing something more complex when
>>> we've got the same property in three places: -D, parent<properties>,
>>> and profile<properties>. The command line isn't always winning.
>>>
>>> What are we missing?
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: -D versus properties at top level and in profiles

Posted by Kalpak Gadre <ka...@gmail.com>.
Try this,

<project xmlns="http://maven.apache.org/POM/4.0.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.test</groupId>
<artifactId>property</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<myprop>project</myprop>
</properties>
<profiles>
<profile>
<id>foo</id>
<properties>
<myprop>project-profile</myprop>
</properties>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>test</phase>
<configuration>
<tasks>
<echo message="Value: ${myprop}" />
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

Works as expected for me as of 2.2.1 -D always wins.


> I thought -D would win always too.
>
> On Mon, May 3, 2010 at 1:32 PM, Benson Margulies<bi...@gmail.com>  wrote:
>    
>> We thought (my coworkers and I) that -D would win any conflict of
>> properties. But we seem to be experiencing something more complex when
>> we've got the same property in three places: -D, parent<properties>,
>> and profile<properties>. The command line isn't always winning.
>>
>> What are we missing?
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>      
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>    


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: -D versus properties at top level and in profiles

Posted by Paul Benedict <pb...@apache.org>.
I thought -D would win always too.

On Mon, May 3, 2010 at 1:32 PM, Benson Margulies <bi...@gmail.com> wrote:
> We thought (my coworkers and I) that -D would win any conflict of
> properties. But we seem to be experiencing something more complex when
> we've got the same property in three places: -D, parent <properties>,
> and profile <properties>. The command line isn't always winning.
>
> What are we missing?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org