[antlr-interest] Antlr 3 Ant task?
Hendrik Maryns
qwizv9b02 at sneakemail.com
Thu Oct 30 10:09:02 PDT 2008
Jim Idle schreef:
> On Thu, 2008-10-30 at 12:52 +0100, Hendrik Maryns wrote:
>> Hi,
>>
>> I want to call ANTLR from Ant. This works now by adapting the code
>> found at http://www.ociweb.com/jnb/jnbJun2008.html#AntTips (and download
>> elsewhere).
>>
>> However, I’d prefer to use the antlr task directly. This only works
>> with Antlr 2. I found
>> file:///home/hendrik/Java/antlr3-task/antlr3-task.htm, but was unable to
>> get this to work. Ant complains about the xmlns not found or something.
>> Can somebody give a step-by-step instruction on how to get the antlr3
>> task to work.
>>
>> Is there any progress in making this the default antlr ant task, or to
>> update the existing one with a version attribute?
>
> The one you can download from the main downloads page works for me so
> long as the ANT configuration is good and you put the jar in the correct
> place for extensions. Just follow the instructions in the embedded html
> page in the download.
I didn’t find any reference to ant on http://www.antlr.org/download.html.
The relevant instruction in my build file is:
<antlr:antlr3 xmlns:antlr="antlib:org/apache/tools/ant/antlr"
target="${srcdir}/ANTLR/${grammar.name}.g">
<classpath path="/home/hendrik/Java/antlr-3.1.1/lib" />
</antlr:antlr3>
Where /home/hendrik/Java/antlr-3.1.1/lib contains
> ls /home/hendrik/Java/antlr-3.1.1/lib
antlr-2.7.7.jar antlr-3.1.1-runtime.jar
antlr-3.1.1.jar stringtemplate-3.2.jar
I am on openSUSE 11.0.
The Ant error message is:
BUILD FAILED
/home/hendrik/workspace/MonaSearch-own-formulas/build.xml:85: Problem:
failed to create task or type antlib:org/apache/tools/ant/antlr:antlr3
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
This appears to be an antlib declaration.
Action: Check that the implementing library exists in one of:
-/usr/local/eclipse/plugins/org.apache.ant_1.7.0.v200803061910/lib
-/home/hendrik/.ant/lib
-a directory added on the command line with the -lib argument
Now I had this before with jUnit, and it didn’t help putting the
antlr.jar in any of the mentioned directories. For junit, the solution
was to install ant-junit from YaST, but that doesn’t work for antlr,
since it installs a task for antlr2.
even
> ant -lib /home/hendrik/Java/antlr-3.1.1/lib/ antlr
doesn’t work.
More suggestions?
H.
--
Hendrik Maryns
http://tcl.sfs.uni-tuebingen.de/~hendrik/
==================
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 257 bytes
Desc: OpenPGP digital signature
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20081030/0ef42745/attachment.bin
More information about the antlr-interest
mailing list