You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Julien HENRY <he...@yahoo.fr> on 2006/11/16 17:01:01 UTC

Generate source code with a JavaCC parser.

Hi all,

I want to generate Java code for my project with JavaCC. Actually, it's not JavaCC that generate final source code, but JavaCC will generate a parser that will parse one of the file of my project and generate the expected file.

To be clearer, I have a Java file named WebTester.java and I want to generate WebTestCase.java. I wrote a JavaCC file (parser.jj) that generate a Parser.java. Once compiled, Parser.class will take WebTester.java and output WebTestCase.java.

How can I integrate this in my build? I know the maven-javacc-plugin, but it's not exactly what I want. Indeed, the plugin create Parser.java from parser.jj and add it to the Maven build directory, but it doesn't provide a way to run the parser before compile phase.
I'm considering using ant to compile/run Parser.java before the compile phase, but it's ugly. Do you know a better way?

Thanks

Julien




	

	
		
___________________________________________________________________________ 
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! 
Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses 
http://fr.answers.yahoo.com