aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes I dont quite get some terms in build.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "I dont quite get some terms in build.xml" Watch "I dont quite get some terms in build.xml" New topic
Author

I dont quite get some terms in build.xml

xy zhang
Greenhorn

Joined: May 18, 2005
Posts: 14
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

Joined: Oct 10, 2000
Posts: 1364
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

Joined: Nov 14, 2000
Posts: 1953
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

Joined: Jun 25, 2001
Posts: 16141
    
  21

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
xy zhang
Greenhorn

Joined: May 18, 2005
Posts: 14
thanks!

All your answers are very helpful!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I dont quite get some terms in build.xml