This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

I dont quite get some terms in build.xml

 
xy zhang
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
contents in build.xml
<project name="test" default="compile" basedir=".">

<!-- Load all the default properties, and any the user wants -->
<!-- to contribute (without having to type -D or edit this file -->
<property file="${user.home}/build.properties" />
<property file="${basedir}/build.properties" />
<property file="${basedir}/default.properties" />
......

</project>

well, I can find default.properties there, but
-I dont know how they define "build.properties"?
-what does "user.home" here means?I dont find the definition in this build.xml for "user.home".

---
sharrie.zh@gmail.com
 
Carol Enderlin
drifter
Ranch Hand
Posts: 1364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
user.home is the user's home directory.

I added a target with an echo to your build snippet without doing anything to set the user.home:



A property that isn't set in the build or properties file can also be sent in on command-line with -D. Or you can override a built-in value.


What's your question about build.properties?
 
Roseanne Zhang
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is an FAQ for your question:
http://bobcat.webappcabaret.net/javachina/faq/ant_01.htm#ant_abc_Q03

The only thing I need to add is what Carol Enderlin mentioned:

ant -Dpswd=newpassword

This pswd will prevail.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18166
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are a number of predefined properties in Ant. user.home is one of them (look in the online Ant manual for the complete list). Build.properties is just a standard Java proeprties file that's being used to load more properties into Ant.

One tricky thing about Ant properties: Unlike most systems, the FIRST setter of the property wins. This means that you can do things like load user-local properties first, then project properties, then hardcoded (build.xml) properties, and the user properties override the project and hardcoded properties, and the project properties override the harcoded properties. And, of course, properties defined as one-shots on the Ant command line take precedence over all (e.g.: "-Dbuild.type=production").

This can be vary useful. For example, I can use the same build.xml to build against different tomcat release libraries and to set different project directory paths on my local (Windows XP) and test (Solaris) boxes just by setting appropriate property overrides.
 
xy zhang
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks!

All your answers are very helpful!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic