You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by GH...@aol.com on 2001/05/03 01:42:00 UTC

Build files in MASTERING RMI

I am working through the examples in the book "Mastering RMI" by Rickard 
Oberg.
The reason I am addressing my question to this group is that Mr. Oberg has 
provided a build.xml file along with the source code for each of the examples 
in the
book.  But I can get the build to work as intended for each example only if I 
depart
from the instructions given.

The directory structure is:

    C:--|
        masteringrmi--|
                        helloworld--|
                                        src--|
                                              build

The instructions say to do the build, as you might expect, from the build 
subdirectory
simply by invoking Ant.  But when I do this, I do not get the desired final 
directory
structure.

Things work as they should only if I work from the helloworld directory and 
type the
following.

    ant -buildfile c:\masteringrmi\helloworld\src\build\build.xml

The opening portion of the buildfile is as follows:

<?xml version="1.0"?>

<!-- ======================================================================= 
-->
<!-- HelloWorld build file                                                    
   -->
<!-- ======================================================================= 
-->

<project name="HelloWorld" default="main" basedir="../..">
   <path id="project.class.path">
      <fileset dir="${basedir}/lib"/>
      <pathelement location="${basedir}/build/classes" />
   </path>
    
  <target name="init">
    <property name="Name" value="HelloWorld"/>
    <property name="name" value="helloworld"/>
    <property name="version" value="1.0"/>

    <property name="lib.dir" value="${basedir}/lib"/>
    <property name="src.dir" value="${basedir}/src"/>
    <property name="build.dir" value="${basedir}/build"/>
    <property name="dist.dir" value="${basedir}/dist"/>
    <property name="deploy.dir" value="/projects/jboss/dist/deploy"/>
        
    <property name="packages" 
value="masteringrmi.${name}.server,masteringrmi.${name}.interfaces,masteringrm

i.${name}.client"/>

    <property name="build.compiler" value="classic"/>
  </target>

    + more that follows.

The problem appears to be that basedir is not operating as intended.  If you 
run from
the build directory, then the build file should designate helloworld as 
basedir,
shouldn't it?  It seems to me that things are acting like basedir="." instead 
of basedir="../.."

Although everything else appears to work once the proper basedir is 
established,
could the problem be in my setup of Ant?  Or am I just overlooking something
obvious, as is usually the case?  I used Ant in conjuction with a recent 
JavaPro article, and everything appeared to work OK.

I have JDK1.3, Ant1.3, and jaxp1-1.

I have placed jaxp.jar, crimson,jar and xalan.jar in c:\jdk1.3\jre\lib\ext
I have a copy of tools.jar there as well.

And my autoexec file is:

PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;C:\JDK1.3\BIN
SET ANT_HOME=c:\jakarta-ant-1.3
SET JAVA_HOME=c:\jdk1.3
SET PATH=%PATH%;%ANT_HOME%\bin
SET CLASSPATH=.;%ANT_HOME%\lib\ant.jar

I see this behavior on two machines, one with Windows 95 and one with Windows
98.

Can anyone help me??

       Ed Wysocki