ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ozzy Espaillat" <o...@unwiredsolutions.com>
Subject RE: package puzzle
Date Mon, 09 Apr 2001 15:13:03 GMT
Ant does a simple mapping from source to destination dir. It sees
Prj/Prj.java and expects to see Prj/classes/Prj.class which does not exists
when you specify a package. When you add Prj.java to package x the source
file should be in Prj/x/Prj.java and not Prj/Prj.java. Ant (actually I think
it's the compiler) does not see a match unless the directory structure is
correct.

HTH,
Ozzy

-----Original Message-----
From: Macey, Ian [mailto:ian.macey@cazenove.com]
Sent: Monday, April 09, 2001 8:04 AM
To: 'ant-user@jakarta.apache.org'
Subject: RE: package puzzle




> -----Original Message-----
> From: Diane Holt [mailto:holtdl@yahoo.com]
> Sent: 09 April 2001 15:16
> To: ant-user@jakarta.apache.org
> Subject: Re: package puzzle
>
>
> You'll most likely need to respecify the "srcdir" and, if
> you're including
> specific files, the path to where those files are found.
> Specify "srcdir"
> up to the point where the package structure begins and included files
> beginning at com.

Okay, am still confused by Ant's behaviour when I introduce a package.
Have reduced the problem to the following build.xml:

<project name="Prj" default="compile" basedir=".">
    <target name="compile">
        <javac srcdir="." destdir="classes" includes="*.java">
        </javac>
    </target>
</project>

And the following Prj.java:

package x;  //Toggle this line to demo problem

class Prj {
   public static void main(String args[]) {}
}

Both build.xml and Prj.java are located in a directory 'Prj'. One sub
directory, 'classes', is created below 'Prj'.

With the 'package x;' line commented out all is as expected - Prj.class
is created in Prj/classes on the first run of Ant, and subsequent runs of
Ant do nothing (Prj.class is up to date).

WIth the 'package x;' line uncommented (as above) the Prj.class is
created in Prj/classes/x when I run Ant, as expected, but subsequent
runs of Ant also compile Prj.java (even though the Prj.class is up to date
and should not be compiled).

Am obviously missing something here...

Ian


___________________________________________________
CAZENOVE & CO.

DISCLAIMER, PLEASE NOTE:

This communication is for the attention of the
named recipient only and should not be passed
on to any other person. Information relating to
any company or security, is for information
purposes only and should not be interpreted as
a solicitation or offer to buy or sell any security.
The information on which this communication is based
has been obtained from sources we believe to be reliable,
but we do not guarantee its accuracy or completeness.
All expressions of opinion are subject to change
without notice.
___________________________________________________


Mime
View raw message