Discussion:
javacc maven plugin creates invalid jj-file from jjt file
Bertram
2009-04-02 11:08:47 UTC
Permalink
Hello,
I'm using the javacc maven plugin to create of an jjt file a parser. I can
do this via the javacc-eclipse plugin or via at -> works with both.

When using the maven plugin (see below the pom.xml snip) the plugin creates
an invalid jj-file.

Invalid in the way, that in the first-line the absolut-file-path is
generated into the comment, and this causes a problem on windows when the
string \u occurs.

The error there is: Invalid escape character at line 1 column ...
where the first line looks like this in the generated jj file.

/*@bgen(jjtree) Generated By:JJTree: Do not edit this line.
D:\Java\Workspace_3.4\up\up2\target\javacc-1238668669650\node\SearchCriteriaCC.jj
*/

It seems to be like the bug in the link, that got solved with javacc v4.0:
http://www.nabble.com/-jira--Created%3A-(JCR-575)-unicode-escapes-in-files-generated-by-JJTree-td6394696.html#a6394696

All the javacc jars I found on my machine are v4.1

---- POM snip ----

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>javacc-maven-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<phase>generate-sources</phase>
<id>jjtree-javacc</id>
<goals>
<goal>jjtree-javacc</goal>
</goals>
<configuration>
<isStatic>false</isStatic>
<buildParser>true</buildParser>
<sourceDirectory>${basedir}/src/main/javacc</sourceDirectory>

<outputDirectory>${project.build.sourceDirectory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
------------------

Any help, much appreciated.
Bertram Grillitsch
--
View this message in context: http://www.nabble.com/javacc-maven-plugin-creates-invalid-jj-file-from-jjt-file-tp22845508p22845508.html
Sent from the mojo - user mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Benjamin Bentmann
2009-04-02 16:49:16 UTC
Permalink
Post by Bertram
When using the maven plugin (see below the pom.xml snip) the plugin creates
an invalid jj-file.
[...9
All the javacc jars I found on my machine are v4.1
As listed in the "Project Dependencies" [0], the javacc-maven-plugin:2.5
uses javacc 4.1 as well. You can try downgrading to
javacc-maven-plugin:2.4.1 which uses javacc 4.0 or upgrading to javacc
4.2 by adding the snippet

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>javacc-maven-plugin</artifactId>
<version>2.5</version>
<!-- override default plugin dependency -->
<dependencies>
<dependency>
<groupId>net.java.dev.javacc</groupId>
<artifactId>javacc</artifactId>
<version>4.2</version>
</dependency>
</dependencies>
...
</plugin>

to your POM.

Since the actual code generation is the responsibility of the javacc
library and not the wrapping Maven plugin, you would need to report this
issue to the javacc developer team if it persists in their latest release.


Benjamin


[0] http://mojo.codehaus.org/javacc-maven-plugin/dependencies.html

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Bertram
2009-04-06 11:18:03 UTC
Permalink
thanx for the hint.
This actually solved the invalid char problem, but the code generated did
not work with my existing parts.

Found a configuration that works for me.

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>javacc-maven-plugin</artifactId>
<version>2.4</version>
<dependencies>
<dependency>
<groupId>net.java.dev.javacc</groupId>
<artifactId>javacc</artifactId>
<version>4.2</version>
</dependency>
</dependencies>
<executions>
<execution>
<phase>generate-sources</phase>
<id>jjtree-javacc</id>
<goals>
<goal>jjtree-javacc</goal>
</goals>
<configuration>
<isStatic>false</isStatic>
<nodeUsesParser>true</nodeUsesParser>
<sourceDirectory>${basedir}/src/main/javacc</sourceDirectory>

<outputDirectory>${project.build.sourceDirectory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>

thank u
Bertram
Post by Benjamin Bentmann
Post by Bertram
When using the maven plugin (see below the pom.xml snip) the plugin creates
an invalid jj-file.
[...9
All the javacc jars I found on my machine are v4.1
As listed in the "Project Dependencies" [0], the javacc-maven-plugin:2.5
uses javacc 4.1 as well. You can try downgrading to
javacc-maven-plugin:2.4.1 which uses javacc 4.0 or upgrading to javacc
4.2 by adding the snippet
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>javacc-maven-plugin</artifactId>
<version>2.5</version>
<!-- override default plugin dependency -->
<dependencies>
<dependency>
<groupId>net.java.dev.javacc</groupId>
<artifactId>javacc</artifactId>
<version>4.2</version>
</dependency>
</dependencies>
...
</plugin>
to your POM.
Since the actual code generation is the responsibility of the javacc
library and not the wrapping Maven plugin, you would need to report this
issue to the javacc developer team if it persists in their latest release.
Benjamin
[0] http://mojo.codehaus.org/javacc-maven-plugin/dependencies.html
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
--
View this message in context: http://www.nabble.com/javacc-maven-plugin-creates-invalid-jj-file-from-jjt-file-tp22845508p22906753.html
Sent from the mojo - user mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Loading...