You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by ph...@discoverfinancial.com on 2001/12/28 18:15:26 UTC

compiling current directory

I am trying to set up a target that will compile the directory I ran ant
from along with any subdirectories.  For instance if c:\dev is in my
classpath and I am in the c:\dev\foo directory, I want to compile all of
the .java files in foo and all of it's subdirectories.

<target name="compile">
  <property name="src" value="${user.dir}"/>

  <!-- ${dev_dir} is set up on the command line.  It will be c:\dev in this
example.
  <property name="build" value="${dev_dir}"/>

  <javac srcdir="${src}" destdir="${build}"/>
</target>

This works, but it always compiles ALL of the files instead of just the
ones that changed.

The ant documentation for the javac task states:
Note: If you wish to compile only source-files located in some packages
below a common root you should not include these packages in the
srcdir-attribute. Use include/exclude-attributes or elements to filter for
these packages. If you include part of your package-structure inside the
srcdir-attribute (or nested src-elements) Ant will start to recompile your
sources every time you call it.

but, I can't seem to figure out what the documentation is talking about.
Can someone please point me in the right direction?

Thanks,
Phil

Using ant 1.4.1 and jdk 1.3.0


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: compiling current directory

Posted by Steve Loughran <st...@iseran.com>.
----- Original Message -----
From: <ph...@discoverfinancial.com>
To: <an...@jakarta.apache.org>
Sent: Friday, December 28, 2001 09:15
Subject: compiling current directory


> I am trying to set up a target that will compile the directory I ran ant
> from along with any subdirectories.  For instance if c:\dev is in my
> classpath and I am in the c:\dev\foo directory, I want to compile all of
> the .java files in foo and all of it's subdirectories.
>
> <target name="compile">
>   <property name="src" value="${user.dir}"/>
>
>   <!-- ${dev_dir} is set up on the command line.  It will be c:\dev in
this
> example.
>   <property name="build" value="${dev_dir}"/>
>
>   <javac srcdir="${src}" destdir="${build}"/>
> </target>
>
> This works, but it always compiles ALL of the files instead of just the
> ones that changed.
>
> The ant documentation for the javac task states:
> Note: If you wish to compile only source-files located in some packages
> below a common root you should not include these packages in the
> srcdir-attribute. Use include/exclude-attributes or elements to filter for
> these packages. If you include part of your package-structure inside the
> srcdir-attribute (or nested src-elements) Ant will start to recompile your
> sources every time you call it.
>
> but, I can't seem to figure out what the documentation is talking about.
> Can someone please point me in the right direction?

you are reading the wrong part of the docs. look further up the page at the
line that goes

The directory structure of the source tree should follow the package
hierarchy.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>