Joe Schmetzer, 21.08.09, 10:14h CEST:

> You can use the <depend> selector:
> http://ant.apache.org/manual/CoreTypes/selectors.html#dependselect
> 
> Use a glob mapper in the depend selector to match the java files to
> the corresponding class files, and the depend selector will pick out
> only those files that have newer class files.

I tried <depend>, but it actually does the opposite of what was needed. In
my case:

<copy todir="${build.client}">
  <fileset dir="${src}" includes="**/*.java">
    <depend targetdir="${build.client}">
      <mapper type="glob" from="*.java" to="*.class"/>
    </depend>
  </fileset>
</copy>

This copies all source files to the destination directory except those
that were compiled.

I somehow overlooked the <present> selector earlier and found out just now
that it does exactly what I want:

<copy todir="${build.client}">
  <fileset dir="${src}" includes="**/*.java">
    <present targetdir="${build.client}">
      <mapper type="glob" from="*.java" to="*.class"/>
    </present>
  </fileset>
</copy>

This adds source files to the compiled classes in the destination
directory.

Best regards,
Stefan

Attachment: pgpMKbTtOlL3J.pgp
Description: PGP signature

Reply via email to