Hello Ant people! I've just joined this list and would like to say
"hi!" to all those old friends from the JServ years.
Second, a caveat: I'm no Ant expert but I couldn't find this problem
discussed in the archives. Also, some of my ways of doing things might
be a bit naive.
Now the problem, I'm using ant 1.4.1 (built 11 Oct 2001) and have a
problem with the jar task.
It's building the jar in a rather unusual way.
Here's the task:
<project ...>
...
<target name="some_jar"
<jar jarfile="${lib}/some.jar"
basedir="${lib}"
includes="uk/co/somepackage/**" />
</target>
</project>
The directory ${lib} contains the built classes in the
uk.co.sompackage package.
The jarfile I get as a result of this is really wierd, it looks like this:
M Length Date Time File
- -------- ----------- -------- ----------------------------
0 15-Jan-2002 10:29:58 meta-inf/
48 15-Jan-2002 10:29:58 meta-inf/manifest.mf
0 14-Jan-2002 11:55:50 uk/
0 14-Jan-2002 11:55:50 uk/co/
0 14-Jan-2002 11:55:50 uk/co/somepackage/
0 14-Jan-2002 11:55:50 uk/co/somepackage/subpack1/
0 14-Jan-2002 11:55:50 uk/co/somepackage/subpack2/
159 14-Jan-2002 11:55:50 uk/co/somepackage/C1.class
2063 14-Jan-2002 11:55:50 uk/co/somepackage/subpack1/C2.class
3051 14-Jan-2002 11:55:52 uk/co/somepackage/subpack2/C3.class
Note that the directories have been created and then the files. This
is not content I would expect to see; if I used the command line I'd
expect the jar file to look like this:
M Length Date Time File
- -------- ----------- -------- ----------------------------
0 15-Jan-2002 10:29:58 meta-inf/
48 15-Jan-2002 10:29:58 meta-inf/manifest.mf
0 14-Jan-2002 11:55:50 uk/
0 14-Jan-2002 11:55:50 uk/co/
0 14-Jan-2002 11:55:50 uk/co/somepackage/
159 14-Jan-2002 11:55:50 uk/co/somepackage/C1.class
0 14-Jan-2002 11:55:50 uk/co/somepackage/subpack1/
2063 14-Jan-2002 11:55:50 uk/co/somepackage/subpack1/C2.class
0 14-Jan-2002 11:55:50 uk/co/somepackage/subpack2/
3051 14-Jan-2002 11:55:52 uk/co/somepackage/subpack2/C3.class
It looks like ANT is creating the directories first and then adding
the class files later.
"Is this important?" I hear you ask. Well, yes it is because I can't get the
ANT generated jar file to load in java.
For example:
Class.forName("uk.co.somepackage.C1");
causes a class not found exception when using the jar file created by
ANT. It's fine when I use the jar created with the command line.
I know I must be doing something wrong because I've used 1.4.1 to
generate jar files before... Does anyone have any idea what is going on?
More information: the jdk is 1.3.1-b24 on Windows.
Nic Ferrier
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>