For the antlr optional task, one can use the <classpath> element to specify
the location of the antlr jar file, so the following will work for Ant 1.6.5 and
ant 1.7.0:

<project default="antlr">
 <target name="antlr">
   <antlr target="etc/java.g"
          outputdirectory="build/src">
     <classpath>
       <fileset dir="${user.home}/antlibs/antlr"
                includes="*.jar"/>
     </classpath>
   </antlr>
 </target>
</project>

One may also put the antlr.jar file in ~/.ant/lib or in $ANT_HOME/lib.

Peter

On 2/25/07, Omry Yadan <[EMAIL PROTECTED]> wrote:
Hi Antoine,

The task I am trying to use is a 'built-in' optional task, specifically
- antlr.

to my knowledge, I can't define it using a taskdef directive.



Antoine Levy-Lambert wrote:

> Hello Omry,
>
> it is good practice to work the way you envision to do.
>
> The manual page for junit
> http://ant.apache.org/manual/OptionalTasks/junit.html gives some
> informations concerning this question.
>
> Supposing junit is one of the optional tasks for which you want to use
> a version stored in the directory tree of the build file, you can
> choose the option <5> from the manual page (assuming you are using ant
> 1.7.0)
>
> So you would add in your build file this line
>
> <taskdef name="junit"
> classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"
> classpath="lib/junit/junit-x.y.z.jar"/>
This will not work due to classloader issues.

For ant1.7.0 one can use the <classpath> nested element of <junit>
to specify the location of the junit.jar file.

Peter

>
> assuming you have ant-junit.jar under $ANT_HOME/lib (which is the
> default if you use one of our releases) and you have a subdirectory
> lib/junit with junit-x-y-z.jar in it in, relative to the basedir of
> the build file.
>
> Best regards,
>
> Antoine
>
>
> On Feb 25, 2007, at 10:15 AM, Omry Yadan wrote:
>
>> is it possible to add the reference to the required jars for an
>> optional task as a part of the build.xml?
>> similar to the way  I can add my own tasks and keep them with the
>> build.xml
>> this will make build files much more portable across different
>> machines, because it will be possible to bundle the build.xml with
>> the jars required by the optional tasks it uses.
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to