Finally, it works with another module. I just have to use the javacc plugin in 
the generate-sources phase of this new module. In the module where I want to 
generate source, I use the exec plugin to run the Parser.
The only problem is I have to generate the new source file in src/main/java 
because I have no way to specify a second source directory in the pom (for 
example target/generated-sources).

Thanks !

----- Message d'origine ----
De : Julien HENRY <[EMAIL PROTECTED]>
À : Maven Users List <[email protected]>
Envoyé le : Vendredi, 17 Novembre 2006, 9h48mn 58s
Objet : Re : Generate source code with a JavaCC parser.

Thanks for the reply. 

I'm currently have a multi-module layout. Could it be possible to put the 
parser in a new module? The problem I see is the Parser.jar should be installed 
in the local repository before the generate-sources phase of the module that 
need it to generate the .java file.
Actually, I'm looking for a way to build the whole project with only one 
command (easier for continuum). With your solution, I need to build and install 
the parser first, then build my regular project.

Thanks again.

Julien

----- Message d'origine ----
De : Chris Hilton <[EMAIL PROTECTED]>
À : Maven Users List <[email protected]>
Envoyé le : Jeudi, 16 Novembre 2006, 18h36mn 05s
Objet : RE: Generate source code with a JavaCC parser.

To my eyes (and how I've done it before), this would be two projects. One 
project to create the Parser and jar it. Then the second project would use that 
jar as a dependency and execute the appropriate class during the 
generate-sources phase.

Or you could get a little fancy and have the first project actually generate a 
Maven plugin with the Parser and then bind that plugin appropriately in the 
second project.

Hope that helps.

Chris

> -----Original Message-----
> From: Julien HENRY [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, 16 November, 2006 10:01
> To: [email protected]
> Subject: 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
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]








    

    
        
___________________________________________________________________________ 
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






        

        
                
___________________________________________________________________________ 
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

Reply via email to