You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by peter <pe...@btinternet.com> on 2001/09/18 10:53:53 UTC

mirroring src directory

Hi

I'm trying a write a simple ant buildfile that complies my java classes from
a src dir into a classes dir.  I've already created the src directory and
its sub dirs, and have created the classes dir which exactly mirrors the dir
structure of src.

src---                                  classes---
        |                                                |
        -controller                                 -controller
        -beans---                                  -beans---
                      |                                                |
                      -formbeans                                -formbeans
                      -statebeans                                -statebeans
                      -sessionbeans                            -sessionbeans

The problem is that when i run ant on my build.xml file the src files are
only compiled to the classes directory and not to any sub dirs under the
classes dir, thus not mirroring the true dir structure of the src dir.  Here
is my build file:

<project name="simple" default="build" basedir=".">

  <target name="init">
    <property name="src" value="src" />
    <property name="dest" value="classes" />
  </target>

  <target name="build" depends="init">
    <javac  srcdir="${src}" destdir="${dest}">
      <include name="controller/**"/>
      <include name="beans/statebeans/**"/>
      <include name="beans/sessionbeans/**"/>
      <include name="beans/formbeans/**"/>
      <classpath>
        <pathelement location="struts.jar"/>
        <pathelement location="commons-beanutils.jar"/>
        <pathelement location="commons-collections.jar"/>
        <pathelement location="commons-digester.jar"/>
        <pathelement location="${src}"/>
      </classpath>
    </javac>
  </target>

</project>

Thanks

Peter