import-bot (20211) [Avatar] Offline
#1
<jar> task and basedir attribute
[Originally posted by klaasvg]

Chapter 1:
When the build.xml in Learning/ch01 is executed, a project.jar is created but
this does not contain the 2 class files.
When the attribute basedir="." is added to the jar task, it works OK.
Does this mean that the basedir attribute does not default to the current
directory ??? Is this an error in the book or has it to to with different Ant
versions ?
Moreover, the jarfile attribute you use is not mentioned in the Ant
documentation. Is there a reason you use this instead of the destfile
attribute ?
import-bot (20211) [Avatar] Offline
#2
Re: <jar> task and basedir attribute
[Originally posted by erikhatcher]

jarfile was the original attribute name, but destfile was added later to
standardize attribute names
across tasks. jarfile works in more versions of Ant than destfile, so we
likely chose to use it for
that reason.
import-bot (20211) [Avatar] Offline
#3
Re: <jar> task and basedir attribute
[Originally posted by klaasvg]

OK, that's clear to me ! But the first part of my question remains
unanswered... And that was the most important part of it. So one more attempt:

Chapter 1:
When the build.xml in Learning/ch01 is executed, a project.jar is created but
this does not contain the 2 class files.
When the attribute basedir="." is added to the jar task, it works OK.
Does this mean that the basedir attribute does not default to the current
directory ??? Is this an error in the book or has it to to with different Ant
versions ?

Grtz, Klaas
import-bot (20211) [Avatar] Offline
#4
Re: <jar> task and basedir attribute
[Originally posted by erikhatcher]

The main thing I can say is that what you observe is how it works! smilie My
recommendation is to
always use the basedir attribute to be absolutely clear on where it is - I
took a look at the Jar.java
file in Ant's codebase and it was a bit confusing on what the default value
is, and based on your
experience it is not the base directory of the project necessarily (depends on
whether you have a
nested fileset or not, it seemed).

I'm not sure if this behavior changed in one of Ant's point releases. We
apologize for the error in
building project.jar - just add basedir="." and all is well. smilie)