This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Cattle Drive and the fly likes build.xml question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "build.xml question" Watch "build.xml question" New topic
Author

build.xml question

Carol Murphy
village idiot
Bartender

Joined: Mar 15, 2001
Posts: 1194
I'm trying to decode this build file. Line 3, the project tag, sets the default attribute (am I correct in calling this an attribute?) to "build" and the basedir to "." which I am assuming is the directory from which you launch the "ant deploy" or "ant all deploy" command, or whatever else you want to do. If this is correct, then on my system, the project tag has told Ant to put stuff (or look for it?) in C:\java\build\.
(Am I on the right track so far?)

I noticed on lines 9 and 10 that the property tags for src.dir and resources.dir indicate that these directories are to be put inside the basedir, so they will be found at C:\java\src\ and C:\java\resources\ respectively. But line 11 puts the build.dir directly at build\. I am assuming that the project tag has already told Ant to put build in the basedir, therefore it doesn't have to give the fully qualified location as it did in lines 9 and 10. Is this correct? (Also, is my terminology correct? I hate calling things by the wrong name. It adds to my confusion, as well as making discussion confusing.


<?xml version="1.0"?>
< !-- This build file uses ant 1.6 -->
<project name="bee" default="build" basedir=".">

<target name="init">
<property file="${user.home}/build.properties"/>
<property name="app.name" value="bee"/>

<property name="src.dir" location="${basedir}/src"/>
<property name="resources.dir" value="${basedir}/resources"/>
<property name="build.dir" location="build"/>
<property name="classes.dir" location="${build.dir}/classes"/>

<property name="dist.dir" location="${build.dir}/dist"/>
</target>

(I didn't ask for my title without good reason.....)
[ February 27, 2006: Message edited by: Carol Murphy ]
Chandra Sagi
Ranch Hand

Joined: May 05, 2005
Posts: 162
no code.......
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
Originally posted by Chandra Sagi:
no code.......

I believe she is referring to this ant build file.


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10


CM: I'm trying to decode this build file. Line 3, the project tag, sets the default attribute (am I correct in calling this an attribute?)

MdQ: Yes, it is an attribute.

CM: to "build" and the basedir to "." which I am assuming is the directory from which you launch the "ant deploy" or "ant all deploy" command, or whatever else you want to do. If this is correct, then on my system, the project tag has told Ant to put stuff (or look for it?) in C:\java\build\.

MdQ: You're almost correct. You have set the default target to "build" and the basedir to whichever directory your build.xml file lives in (which is probably C:\java, the same directory that your src and resources subdirectories live in).

CM: (Am I on the right track so far?)

I noticed on lines 9 and 10 that the property tags for src.dir and resources.dir indicate that these directories are to be put inside the basedir, so they will be found at C:\java\src\ and C:\java\resources\ respectively. But line 11 puts the build.dir directly at build\. I am assuming that the project tag has already told Ant to put build in the basedir, therefore it doesn't have to give the fully qualified location as it did in lines 9 and 10. Is this correct? (Also, is my terminology correct? I hate calling things by the wrong name. It adds to my confusion, as well as making discussion confusing.

MdQ: Good observation, Carol. Actually, the ${basedir} part of lines 9 and 10 appear to be redundant for our use since src.dir and resources.dir are also subdirectories of the basedir.

p.s. by "fully qualified location" I suspect you mean "absolute path"
[ February 27, 2006: Message edited by: Marilyn de Queiroz ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: build.xml question
 
Similar Threads
Warning Message When I Ran My ANT build.xml File
J2EE Deployment using ANT
Ant building error
Build failed- ejb3.deployer not found
an ant question