You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Rhino <rh...@sympatico.ca> on 2005/01/27 23:33:00 UTC

Problem with classfileset

I'm trying to use classfileset to build a jar for the first time but it
doesn't seem to be recursing the way I expected.

This is my target:
<!--==================================================================

Jar everything together into one big jar.

==================================================================-->

<target name="Jar_all" description="Jar all classes that are needed by Foo
project.">

<classfileset id="reqdClasses" dir="${bin.dir}">

<root classname="mydomain.foo.Foo"/>

</classfileset>

<delete file="${jar.dir}/All.jar" description="delete old jar"/>

<jar destfile="${jar.dir}/All.jar" description="create new jar">

<fileset refid="reqdClasses"/>

</jar>

</target>


When I run it, the jar contains only three class files (and a manifest):

mydomain.foo.Foo.class
mydomain.foo.FooConstants.class
mydomain.foo.FooPreferences.class

mydomain.foo.Foo is indeed the main class of the program and it is indeed
dependent on mydomain.foo.FooConstants and mydomain.foo.FooPreferences.

Unfortunately, none of the classes that *they* depend on are present in the
jar. There are quite a few of them, all belonging to packages starting with
mydomain.common.

I assume that I've written the target incorrectly and have omitted something
that tells Ant to recurse to find the dependencies of the dependencies but I
can't find any clarification of this in the manual.

Could someone please confirm that the classfileset *does* find dependencies
recursively and explain what I need to change in my target to make the
recursion take place?

If classfileset does not recurse, can anyone suggest any other way in which
Ant could be used to build a jar containing my main class and *ALL* of its
dependents, not just the immediate 'children' but all of the
'grandchildren', 'great-grandchildren' etc.?


Rhino
---
rhino1 AT sympatico DOT ca
"There are two ways of constructing a software design. One way is to make it
so simple that there are obviously no deficiencies. And the other way is to
make it so complicated that there are no obvious deficiencies." - C.A.R.
Hoare



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.7.4 - Release Date: 25/01/2005


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org