You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Rich Harris <ri...@soggymonkey.com> on 2001/03/07 20:05:37 UTC

Compiling multiple source files....

Folks,
    I'm trying to figure out how to simultaneously build two files that
cannot exist without the other that are located in two different
directories. How can I do it in ANT?

Here is my code. Assume that file1.java and file2.java cannot be
compiled unless the other exists.

I've tried two ways:
===============================
First attempt:
<exec dir="${SRCDIR}/Directory1" command="${JAVA_HOME}\\bin\\javac
-deprecation "${SRCDIR}\\Directory1\\file1.java"
"${SRCDIR}\\Directory2\\file2.java"" />
===============================
Second attempt
<javac classpath="${CLASSPATH}"
              srcdir="${SRCDIR}/Directory1"
              destdir="${BUILDDIR}"
              filtering="on"
              deprecation="on"
              includes="${SRCDIR}\\Directory2\\file2.java"
              excludes=""
              />
    </target>
===============================


Not sure what to do here. I'm stuck in a situation with someone else's
code and there are lots of circular dependencies. HELP ME!

Thanks for your time,
Rich


RE: Compiling multiple source files....

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
Rich,

This answer depends on what packages your classes are in. If I assume that
both classes are in the unnamed package (i.e. no package statement), this
should work

<javac classpath="${CLASSPATH}"
       destdir="${BUILDDIR}"
       deprecation="on"
       >
    <src path="${SRCDIR}/Directory1"/>
    <src path="${SRCDIR}/Directory2"/>
    <include name="file1.java"/>
    <include name="file2.java"/>
</javac>

Conor


RE: Compiling multiple source files....

Posted by james <ja...@unikala.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

make sure that CLASSPATH includes both files.


james@unikala.com


- -----Original Message-----
From: Rich Harris [mailto:rich@soggymonkey.com]
Sent: Wednesday, March 07, 2001 11:06 AM
To: ant-user@jakarta.apache.org
Subject: Compiling multiple source files....


Folks,
    I'm trying to figure out how to simultaneously build two files
that
cannot exist without the other that are located in two different
directories. How can I do it in ANT?

Here is my code. Assume that file1.java and file2.java cannot be
compiled unless the other exists.

I've tried two ways:
===============================
First attempt:
<exec dir="${SRCDIR}/Directory1" command="${JAVA_HOME}\\bin\\javac
- -deprecation "${SRCDIR}\\Directory1\\file1.java"
"${SRCDIR}\\Directory2\\file2.java"" />
===============================
Second attempt
<javac classpath="${CLASSPATH}"
              srcdir="${SRCDIR}/Directory1"
              destdir="${BUILDDIR}"
              filtering="on"
              deprecation="on"
              includes="${SRCDIR}\\Directory2\\file2.java"
              excludes=""
              />
    </target>
===============================


Not sure what to do here. I'm stuck in a situation with someone
else's
code and there are lots of circular dependencies. HELP ME!

Thanks for your time,
Rich


-----BEGIN PGP SIGNATURE-----
Version: PGP Personal Privacy 6.5.8

iQA/AwUBOqa3KAXY7J7Vn/AcEQLWQgCdF59njPaj6z+2EefZWi48EZtIh5MAn2rI
Mqzl+WuXUyD+i73x+JtKsYXK
=t7K3
-----END PGP SIGNATURE-----