2013-02-21 5 views
2

제 질문은 ANT를 ANTLR3과 함께 사용하는 것입니다. ant를 antlr3와 함께 사용하는 방법

내가 개미 antlr3을 다운로드하여 내 build.xml 파일 넣어에서 디렉토리

eclipse-jee-helios-SR2-win32-x86_64\eclipse\plugins\org.apache.ant_1.7.1.v20100518-1145\lib 

에 넣어 :

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 
:

`<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 목표 실행이 오류를 가져옵니다

무엇을해야할지 모르는 사람을 기쁘게 해주시겠습니까?, classpath에 ant-antlr3을 찾지 못했습니다.

답변

1

은 내가 antlr 작업을 사용하지만, 단순히 libs에 ANTLR의 JAR를 넣고 같은 것을하지 않는다 :

<path id="classpath"> 

    <!-- more entries here --> 

    <fileset dir="lib"> 
     <include name="*.jar" /> 
    </fileset> 
</path> 

<target name="generate"> 
    <echo>generating the parser and lexer</echo> 
    <java classname="org.antlr.Tool" fork="true" failonerror="true"> 
     <arg value="-fo" /> 
     <arg value="path/to/output/generated/files" /> 
     <arg value="path/to/Grammar.g" /> 
     <classpath refid="classpath" /> 
    </java> 
</target> 
+1

나는 동일을, 그러나 나는 또한 자동으로 ANTLR 도구를 다운로드하는 설정 빌드 도중 lib 폴더에 이미 존재하지 않는다면 (또는 구식이므로) 소스 제어에 라이브러리를 보관할 필요가 없습니다. –

+1

예제'build.xml' (자동 다운로드 및 최신 검사 포함) : https://github.com/antlr/stringtemplate4/blob/master/build.xml –

+0

@ 280Z28, 그것은 깔끔한 아이디어입니다. "Ant-a-la-Maven", 이렇게 말하자면 :) –

관련 문제