I can't figure how to set up Ant so that it will scale to be usable
on a large project. Is there an 'Ant-way-of-doing-things' that I haven't
grokked yet?
For example, suppose my source files are
com/x/app/Application.java
com/x/util/Alpha.java
com/x/util/Beta.java
And packages are as you'd expect.
Initially, I could try a com/x/app/build.xml like:
<project name="com.x.app.Application" default="compile" basedir="../..">
<target name="compile">
<javac srcdir="." destdir=".">
<include name="com/x/app/*.java"/>
<include name="com/x/util/*.java"/>
</javac>
</target>
</project>
(Question: is this a reasonable build.xml? Should it be in com/x/app,
or would you keep it somewhere else? Would you use a different
project name, a different basedir, would you do the javac element
differently, etc.?)
One scaling problem is that I might not want to compile everything in
com/x/util - perhaps the still-being-developed DoesntWorkYet.java
doesn't compile. I could change the javac element to:
<javac srcdir="." destdir=".">
<include name="com/x/app/Application.java">
<include name="com/x/util/Alpha.java">
<include name="com/x/util/Beta.java">
</java>
but it's obvious that this direction of changes won't scale - suppose
com/x/util gets refactored to require com/x/util/NewStuff.java, etc.;
I don't want com/x/app to have to know the details of how com/x/util
is structured.
I could try using XML entities - after all, com/x/util is the best
place to keep the list of files I need to include - I might create
com/x/util/includes.xml:
<include name="com/x/util/Alpha.java">
<include name="com/x/util/Beta.java">
and change com/x/app/build.xml to:
<?xml version="1.0"?>
<!DOCTYPE project [
<!ENTITY com.x.util.includes SYSTEM "file:../util/includes.xml">
]>
<project name="com.x.app.Application" default="compile" basedir="../..">
<target name="compile">
<javac srcdir="." destdir=".">
<include name="com/x/app/Application.java"/>
&com.x.util.includes;
</javac>
</target>
</project>
But com/x/util/includes.xml might itself use entities that
com/x/app/build.xml hasn't defined. (XML's parameter entities might
provide a solution)
Or, stuff in com/x/util might be machine generated and thus might
impose dependancies on com/x/app's build.xml's compile target.
What's the Ant way of solving these kinds of problems?
tim
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]