Monday, July 28, 2008

JavaCC Maven Plugin and JJTree User definied Node Classes

Well I'm using JJTree (the Javacc preprocessor) to build a parsed tree model of the language that I'm implementing.

I also use maven to manage my project as usually and so I use the javacc maven plugin JavaCC Maven Plugin to integrate the jjtree and javacc commands into the project build lifecycle.

All worked fine until I start to provide my own defined node classes for the JJTree model.
In this case I experienced same unpleasant behaviors of jjtree about mixing generated and user provided java sources.

In fact I could not maintain well divided my sources implementing tree nodes from jjtree generated ones.

In particularity with the javacc maven plugin default configuration, the sources generation process ignores my java classes located in the default sources directory src/main/java and at the end of the process I obtain a compilation error of duplicate class. In fact for each classes I define I find also the generated one into the directory target/generated-sources/javacc.

So I decide to remove the java files from the generated sources directory in the case I had yet provided it.

Here the pom file with the ant code passed to maven-antrun-plugin to do this dirty work




About Me

Milano, Italy
Software Architect and Software Solution Advisor