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/21 13:38:40 UTC

Re : Re : Re : Generate source code with a JavaCC parser.

Hi Chris,

I have another issues with this configuration (Exec plugin + Empty Ant Task)). First, Javadoc is not generated for the generated class. It is when I call mvn javadoc:javadoc, but not with mvn site. Perhaps because I'm using aggregate=true.

Second issue is I add the module containing the JavaCC parser as a dependency in order to the exec plugin to find it. But this module is not required at runtime, and I don't want it in the Eclipse classpath or in the bundle. Can I configure the parser module as a plugin dependency and not as a project dependency?

Thanks.

Julien

----- Message d'origine ----
De : Chris Hilton <ch...@alterpoint.com>
À : Maven Users List <us...@maven.apache.org>
Envoyé le : Vendredi, 17 Novembre 2006, 17h13mn 45s
Objet : RE: Re : Re : Generate source code with a JavaCC parser.

It might be worthwhile to use the Antrun plugin for the short term with a <java> task and the <sourceRoot> config element so that you don't have to mix your generated source code with the regular source (bad CM). Or even using the exec plugin and an empty task Antrun plugin with the new <sourceRoot> might work. You might also consider adding a feature request to JIRA for the exec plugin to include a way to add a source directory.

Chris

> -----Original Message-----
> From: Julien HENRY [mailto:henryju@yahoo.fr] 
> Sent: Friday, 17 November, 2006 07:08
> To: Maven Users List
> Subject: Re : Re : Generate source code with a JavaCC parser.
> 
> 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 <he...@yahoo.fr>
> À : Maven Users List <us...@maven.apache.org> 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 <ch...@alterpoint.com> À : Maven Users 
> List <us...@maven.apache.org> 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:henryju@yahoo.fr]
> > Sent: Thursday, 16 November, 2006 10:01
> > To: users@maven.apache.org
> > 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: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 
> 
> 
> 
> 
> 
>     
> 
>     
>         
> ______________________________________________________________
> _____________
> 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
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org








	

	
		
___________________________________________________________________________ 
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