2
我的問題是關於使用ANT與ANTLR3。如何使用Antlr與antlr3
我下載螞蟻antlr3並把它放在目錄
eclipse-jee-helios-SR2-win32-x86_64\eclipse\plugins\org.apache.ant_1.7.1.v20100518-1145\lib
在我的build.xml地說:
`<path id="classpath">
<pathelement location="${lib}/antlr-3.4-complete.jar"/>
<pathelement location="${lib}/ant-antlr3.jar"/>
</ path>`
`<target name="antlr" depends="init">
<antlr: ant-antlr3 xmlns: antlr = "antlib: org/apache/tools/ant/antlr"
target = "$ {Analyzers}/AnalizadorLexer.g"
outputdirectory = "$ {AnalizadoresBuild}"
verbose = "true">
<classpath refid="classpath"/>
</ antlr: ant-antlr3>
</ target>`
運行ANTLR目標得到這個錯誤:
BUILD FAILED
C: \ Users \ melmar \ Documents \ workspace \ PL \ Prac12 \ build_pol.xml: 68: Problem: failed to create task or type antlib: org/apache/tools/ant/antlr: ant-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>/declarations have taken place <macrodef>.
No types or tasks Have Been In This namespace defined yet
This appears to be an antlib declaration.
Action: Check That the Implementing library exists in one of:
-C: \ Users \ melmar \. Ant \ lib (don´t exist)
-a directory added on the command line argument With The-lib
請問任何人都知道該怎麼辦?沒有在課程路徑中找到ant-antlr3
我做同樣的,但我也有它設置爲自動下載ANTLR工具進入lib文件夾,如果它不在那裏(或過期),所以我不必將庫保存在源代碼管理中。 – 2013-02-21 21:12:28
示例'build.xml'包括自動下載和完整的最新檢查:https://github.com/antlr/stringtemplate4/blob/master/build.xml – 2013-02-21 21:13:32
@ 280Z28,這是一個整潔的想法。 「Ant-a-la-Maven」,所以要說:) – 2013-02-22 08:00:47