You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by David Corbin <dc...@allureglobal.com> on 2007/05/08 21:03:31 UTC

Default property values

When I used to do ant, I always got frustrated by the way properties were 
immutable.  I was always trying to use them as variables.

Now, I find myself wanting them back.

I would like to be able to declare proprties in my POM such that it will NOT 
replace/define the property if it is already available (such as one that is 
defined on the command line with -D).

Can this be done?

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


Re: Default property values

Posted by Greg Morgan <dr...@cox.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

David Corbin wrote:
> When I used to do ant, I always got frustrated by the way properties were 
> immutable.  I was always trying to use them as variables.
> 
> Now, I find myself wanting them back.
> 
> I would like to be able to declare proprties in my POM such that it will NOT 
> replace/define the property if it is already available (such as one that is 
> defined on the command line with -D).
> 
> Can this be done?

Would you please provide an example of what you are describing?  I read
your email several times.  However, I think there is a misunderstanding
here.

I believe it is desirable to localize as much of the project and
property definition in the pom.xml file for team communication.
Settings.xml files are used to supply or override per user information
such as passwords.

Finally, the -D command line options are designed to override the
settings in the pom.xml to trigger profiles or override defaults in the
pom.  Based on what the Sam's Ant Developer's Handbook says on page 87,
"It is important to note that properties set on the command line take
precedence over those set by <property> tasks or in properties files."
That Ant behavior sounds like the same behavior that Maven uses.

Perhaps you are looking for profile functionality?

Appendix A in this free pdf book,
http://www.mergere.com/m2book_download.jsp , has a good explanation of
expression evaluation and profile activation.  This may be a good
resource to explore what you are trying to do.

HTH

Regards,
Greg

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFGQY2ixyxe5L6mr7IRAq2AAKCgXbuINOzobZZZylV4ztX8/qUThACgii3+
UbwBOD3xyEWUBdnNZs4qlHM=
=tpAf
-----END PGP SIGNATURE-----

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


Re: Default property values

Posted by Roland Asmann <Ro...@cfc.at>.
Properties that are given over the command-line ALWAYS prevail over those that 
are coded in the POM.


On Tuesday 08 May 2007 21:03, David Corbin wrote:
> When I used to do ant, I always got frustrated by the way properties were
> immutable.  I was always trying to use them as variables.
>
> Now, I find myself wanting them back.
>
> I would like to be able to declare proprties in my POM such that it will
> NOT replace/define the property if it is already available (such as one
> that is defined on the command line with -D).
>
> Can this be done?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org

-- 
Roland Asmann

CFC Informationssysteme Entwicklungsgesellschaft m.b.H
Bäckerstrasse 1/2/7
A-1010 Wien
FN 266155f, Handelsgericht Wien

Tel.: +43/1/513 88 77 - 27
Fax.: +43/1/513 88 62
Email: Roland.Asmann@cfc.at
Web: www.cfc.at

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