Sunil: I think you need to put antlrtool.jar in your classpath. Let me know how that works.
mani -----Original Message----- From: Sunil Mishra [mailto:[EMAIL PROTECTED] Sent: Monday, June 28, 2004 6:34 PM To: Ant Users List Subject: Re: ANTLR task doesn't update its output But, if it were a classpath problem, I would not have antlr working at all. If the output files are not present, the antlr output is correctly written out. But if the antlr file is touched, the timestamp on the output file is not updated. In fact, if I put some garbage into the grammar file, I even get an error: $ ant -f antlr-build.xml compileParser Buildfile: antlr-build.xml copyLib: compileParser: [antlr] ANTLR Parser Generator Version 2.7.2 1989-2003 jGuru.com [antlr] error: Token stream error reading grammar(s): [antlr] /Volumes/Unix/users/smishra/devl/aic/jtp/beta/java/src/jtp/fol/kif/ KIFParser.g:2:1: expecting '{', found 'f' [antlr] /Volumes/Unix/users/smishra/devl/aic/jtp/beta/java/src/jtp/fol/kif/ KIFParser.g:2:1: rule grammar trapped: [antlr] /Volumes/Unix/users/smishra/devl/aic/jtp/beta/java/src/jtp/fol/kif/ KIFParser.g:2:1: unexpected token: foo [antlr] Exiting due to errors. I guess I chose a poor subject line. It should have said "ANTLR task doesn't update its output timestamp". I'm not sure what to make of this behavior. Sunil On Jun 28, 2004, at 3:20 PM, Matt Benson wrote: > Seems so. Be that as it may, your output shows that > classes are not being found. Since you are using the > same classpath over and over, I would declare it as a > reference: > > <classpath id="antlr.cp"> > <pathelement location="lib/antlr.jar" /> > </classpath> > > when you use it, you can then use: > <classpath refid="antlr.cp" /> > > You can use <pathconvert> or <property> to get your > path into a property, whose value you can then check > by <echo>ing it. It's just a matter of debugging > what's going on by a little trial and error. > > -Matt > > --- Sunil Mishra <[EMAIL PROTECTED]> wrote: >> Here's the compileParser target definition: >> >> <target name="compileParser" depends="copyLib"> >> <antlr target="${parser.dir}/KIFParser.g"> >> <classpath> >> <pathelement location="lib/antlr.jar"/> >> </classpath> >> </antlr> >> <antlr target="${parser.dir}/cnf.g"> >> <classpath> >> <pathelement location="lib/antlr.jar"/> >> </classpath> >> </antlr> >> <antlr target="${parser.dir}/codegen.g"> >> <classpath> >> <pathelement location="lib/antlr.jar"/> >> </classpath> >> </antlr> >> <antlr target="${parser.dir}/simplify.g"> >> <classpath> >> <pathelement location="lib/antlr.jar"/> >> </classpath> >> </antlr> >> </target> >> >> The documentation leads me to believe that >> specifying the classpath >> this way has the same effect as putting the antlr >> jar in the ant lib >> directory. Is that correct? >> >> Sunil >> >> On Jun 28, 2004, at 2:59 PM, Matt Benson wrote: >> >>> Looks like you need to add the ANTLR release >> jar(s) to >>> (most simply) $ANT_HOME/lib, or specify them to >> Ant >>> using the -lib ... option. >>> >>> -Matt >>> >>> --- Sunil Mishra <[EMAIL PROTECTED]> wrote: >>>> Here's the output with the verbose flag... >>>> >>>> Sunil >>>> >>>> >>>> >>>> >>>> $ ant -v -f antlr-build.xml compileParser >>>> Apache Ant version 1.6.1 compiled on February 12 >>>> 2004 >>>> Buildfile: antlr-build.xml >>>> Detected Java version: 1.4 in: >>>> >>> >> > /System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Home >>>> Detected OS: Mac OS X >>>> parsing buildfile >>>> >>> >> > /Volumes/Unix/users/smishra/devl/aic/jtp/beta/java/antlr-build.xml >>>> with >>>> URI = >>>> >>> >> > file:///Volumes/Unix/users/smishra/devl/aic/jtp/beta/java/antlr- >>>> >>>> build.xml >>>> Project base dir set to: >>>> >> /Volumes/Unix/users/smishra/devl/aic/jtp/beta/java >>>> Build sequence for target `compileParser' is >>>> [copyLib, compileParser] >>>> Complete build sequence is [copyLib, >> compileParser, >>>> clean, init, >>>> compile, all, ] >>>> >>>> copyLib: >>>> [copy] antlr.jar omitted as antlr.jar is up >> to >>>> date. >>>> [copy] concurrent.jar omitted as >>>> concurrent.jar is up to date. >>>> [copy] icu4j.jar omitted as icu4j.jar is up >> to >>>> date. >>>> [copy] jakarta-oro-2.0.5.jar omitted as >>>> jakarta-oro-2.0.5.jar is >>>> up to date. >>>> [copy] jdom.jar omitted as jdom.jar is up >> to >>>> date. >>>> [copy] jena.jar omitted as jena.jar is up >> to >>>> date. >>>> [copy] junit.jar omitted as junit.jar is up >> to >>>> date. >>>> [copy] log4j.jar omitted as log4j.jar is up >> to >>>> date. >>>> [copy] xercesImpl.jar omitted as >>>> xercesImpl.jar is up to date. >>>> [copy] xmlParserAPIs.jar omitted as >>>> xmlParserAPIs.jar is up to >>>> date. >>>> >>>> compileParser: >>>> [antlr] Couldn't find >>>> antlr/ANTLRGrammarParseBehavior.class >>>> [antlr] Couldn't find >>>> antlr/ANTLRGrammarParseBehavior.class >>>> [antlr] Setting target to: >>>> >>> >> > /Volumes/Unix/users/smishra/devl/aic/jtp/beta/java/src/jtp/fol/kif/ >>>> >>>> KIFParser.g >>>> [antlr] Setting output directory to: >>>> >>> >> > /Volumes/Unix/users/smishra/devl/aic/jtp/beta/java/src/jtp/fol/kif >>>> [antlr] Compiling >>>> >>> >> > /Volumes/Unix/users/smishra/devl/aic/jtp/beta/java/src/jtp/fol/kif/ >>>> >>>> KIFParser.g as it is newer than >>>> >>> >> > /Volumes/Unix/users/smishra/devl/aic/jtp/beta/java/src/jtp/fol/kif/ >>>> >>>> KIFParser.java >>>> [antlr] Executing >>>> >>> >> > '/System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Home/bin/ >>>> >>>> java' with arguments: >>>> [antlr] '-classpath' >>>> [antlr] >>>> >>> >> > '/Volumes/Unix/users/smishra/devl/aic/jtp/beta/java/lib/antlr.jar' >>>> [antlr] 'antlr.Tool' >>>> [antlr] '-o' >>>> [antlr] >>>> >>> >> > '/Volumes/Unix/users/smishra/devl/aic/jtp/beta/java/src/jtp/fol/kif' >>>> [antlr] >>>> >>> >> > '/Volumes/Unix/users/smishra/devl/aic/jtp/beta/java/src/jtp/fol/kif/ >>>> >>>> KIFParser.g' >>>> [antlr] >>>> [antlr] The ' characters around the >> executable >>>> and arguments are >>>> [antlr] not part of the command. >>>> [antlr] ANTLR Parser Generator Version >> 2.7.2 >>>> 1989-2003 jGuru.com >>>> >>>> >>>> [antlr] Couldn't find >>>> antlr/ANTLRGrammarParseBehavior.class >>>> [antlr] Couldn't find >>>> antlr/ANTLRGrammarParseBehavior.class >>>> [antlr] Setting target to: >>>> >>> >> > /Volumes/Unix/users/smishra/devl/aic/jtp/beta/java/src/jtp/fol/kif/ >>>> >>>> cnf.g >>>> [antlr] Setting output directory to: >>>> >>> >> > /Volumes/Unix/users/smishra/devl/aic/jtp/beta/java/src/jtp/fol/kif >>>> [antlr] Skipped grammar file. Generated file >>>> >>> >> > /Volumes/Unix/users/smishra/devl/aic/jtp/beta/java/src/jtp/fol/kif/ >>>> >>>> CNFConverter.javais newer. >>>> [antlr] Couldn't find >>>> antlr/ANTLRGrammarParseBehavior.class >>>> [antlr] Couldn't find >>>> antlr/ANTLRGrammarParseBehavior.class >>>> [antlr] Setting target to: >>>> >>> >> > /Volumes/Unix/users/smishra/devl/aic/jtp/beta/java/src/jtp/fol/kif/ >>>> >>>> codegen.g >>>> [antlr] Setting output directory to: >> > === message truncated === > > > > > > __________________________________ > Do you Yahoo!? > New and Improved Yahoo! Mail - 100MB free storage! > http://promotions.yahoo.com/new_mail > > --------------------------------------------------------------------- > 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]
