ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ulf Caspers <>
Subject Re: javac-task and mapper
Date Mon, 18 Aug 2003 21:34:50 GMT
On Mon, 18 Aug 2003, Stefan Bodewig <> wrote:

> <java> or <javac>?

> What would the mapper in <javac> be supposed to do?
There is a GlobPatternMapper in the javac-taskdef which is fixed to map
*.java-files to corresponding *.class-files. This is the reason why the
source directory structure and the destination directory structure must
match, which is usually no problem and what is expected by the
java-compiler as well.

Nevertheless there are situations in which this not the best case. I think
about a source layout, where different packages are in different
directories like this:

      !  +--com
      !     +--example
      !        +--pack1

But all packages should be compiled into a common directory like this:

            !  +--Class1.class
            !  +--Class2.class

The following task would compile all sources:

 <javac srcdir="src"

But it would not be able to track unchanged *.java-files and does a
recompile each time ant is invoked.

Todays solution is either calling javac twice or copying all *.java-files
to a common directory before calling javac.

I guess it's faster and easier just to tell javac, how to find matching
sources and output like this:

 <javac srcdir="src"
   <mapper type="regexp" from="[^/]+/(.*)\.java" to="\1.class"/>

Of course <mapper type="glob" from"*.java" to="*.class"/> will be the

Do you think this makes sense?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message