ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <>
Subject RE: Compile stops after first error.. how to avoid that?
Date Wed, 17 Jul 2002 15:01:40 GMT
--- "Hertel, Oliver" <> wrote:
>  > > I want to rebuild the whole project and don't mind if a minor
>  > > subproject doesn't compile, but I need all the other 
>  > classes compiled.
>  > 
>  > You'd need to have separate <javac> tasks.
> Any idea how to do that for 2500 files of sourcecode?

The number of source files wouldn't be the determining factor -- it'd be
how many "minor subprojects" you have.
> Before using ant we had a loop like this
> 	for file in `find . -name *.java`
> 	do
> 	  javac [...] $file
> 	end
> but that was pretty slow.

Indeed -- since you're putting them through one at a time. Ant's <javac>
uses FileSets -- ie., sets of files determined by specifying the base
directory and, optionally, which files to include/exclude from there (the
default fileset for <javac> is all .java files under 'srcdir'), which it
then hands off to the compiler en masse.

So, eg., if you had 10 different packages (or however you have things
organized), and you wanted to build them independent of each other (ie.,
you want the build to continue even if some file in one of them doesn't
compile), then you'd need to have something like:

  <target name="compile">
    <javac srcdir="${srcdir}" destdir="${destdir}" failonerror="${foe}">
      <include name="com/foo/pkg1/**"/>
    <javac srcdir="${srcdir}" destdir="${destdir}" failonerror="${foe}">
      <include name="com/foo/pkg2/**"/>

If you want to try to nest them all under <parallel>, keep this excerpt
from the doc in mind:
  Care must be taken when using multithreading to ensure the tasks
  within the threads do not interact. For example, two javac compile
  tasks which write classes into the same destination directory may
  interact where one tries to read a class for dependency information
  while the other task is writing the class file. Be sure to avoid
  these types of interactions within a <parallel> task.



Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes

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

View raw message