[antlr-interest] Maven vs AntlrWorks Generated Sources

Ramirez, Paul M (388J) paul.m.ramirez at jpl.nasa.gov
Mon Sep 28 15:02:11 PDT 2009


Hi All,

So I added into my configuration the ability to set the options available to me in the maven plugin but this has still lead me nowhere. Antlrworks is still able to build me a parser and lexer that compile but maven isn't. Are there settings that AntlrWorks defaults to in its generating sources different from that of the maven plugin? In addition, the version of java set in the pom seems to have no effect on whether or not the sources are generated. Here is a bigger listing of my pom in case I'm missing some other setting. Sorry for such a long email but I really feel like there is something conflicting in my pom. Thanks in advance for any pointers anyone may have.

<project>
        <modelVersion>4.0.0</modelVersion>
        <parent>
                <groupId>gov.nasa.pds</groupId>
                <artifactId>pds</artifactId>
                <version>0.0.0</version>
        </parent>

        <groupId>gov.nasa.pds</groupId>
        <artifactId>product-tools</artifactId>
        <version>2.0.2</version>
        <packaging>jar</packaging>

        <name>Product Tools Library</name>
        <description>Label Validation Library</description>
        <url>http://pds-cm.jpl.nasa.gov/product-tools/</url>


        <build>
                <sourceDirectory>src/main/java</sourceDirectory>
                <testSourceDirectory>src/test</testSourceDirectory>
                <outputDirectory>target/classes</outputDirectory>
                <resources>
                        <resource>
                                <directory>${basedir}/src/main/resources</directory>
                        </resource>
                        <resource>
                                <directory>${basedir}/target/generated-sources/antlr3</directory>
                        </resource>
                        <resource>
                                <directory>${basedir}/src/main/java</directory>
                        </resource>
                </resources>
                <plugins>
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-compiler-plugin</artifactId>
                                <configuration>
                                        <source>6</source>
                                        <target>6</target>
                                </configuration>
                        </plugin>
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-jar-plugin</artifactId>
                                <configuration />
                        </plugin>
                        <plugin>
                                <groupId>org.codehaus.mojo</groupId>
                                <artifactId>maven-buildnumber-plugin
                                </artifactId>
                                <executions>
                                        <execution>
                                                <phase>validate</phase>
                                                <goals>
                                                        <goal>create</goal>
                                                </goals>
                                        </execution>
                                </executions>
                                <configuration>
                                        <format>{0,date,yyyy-MM-dd HH:mm:ss}</format>
                                        <items>
                                                <item>timestamp</item>
                                        </items>
                                        <doCheck>false</doCheck>
                                        <doUpdate>false</doUpdate>
                                </configuration>
                        </plugin>
                        <plugin>
                                <groupId>org.codehaus.mojo</groupId>
                                <artifactId>build-helper-maven-plugin</artifactId>
                                <version>1.0</version>
                                <executions>
                                        <execution>
                                                <id>add-source</id>
                                                <phase>generate-sources</phase>
                                                <goals>
                                                        <goal>add-source</goal>
                                                </goals>
                                                <configuration>
                                                        <sources>
                                                                <source>target/generated-sources/antlr3</source>
                                                        </sources>
                                                </configuration>
                                        </execution>
                                </executions>
                        </plugin>
                        <plugin>
                                <groupId>org.antlr</groupId>
                                <artifactId>antlr3-maven-plugin</artifactId>
                                <version>3.1.3-1</version>

                                <executions>
                                        <execution>
                                                <phase>generate-sources</phase>
                                                <goals>
                                                        <goal>antlr</goal>
                                                </goals>
                                                <configuration>
                                                        <conversionTimeout>10000</conversionTimeout>
                                                        <debug>false</debug>
                                                        <dfa>false</dfa>
                                                        <nfa>false</nfa>
                                                        <!--<excludes><exclude/></excludes>-->
                                                        <!--<includes><include/></includes>-->
                                                        <libDirectory>src/main/antlr3/imports</libDirectory>
                                                        <messageFormat>antlr</messageFormat>
                                                        <outputDirectory>target/generated-sources/antlr3</outputDirectory>
                                                        <printGrammar>false</printGrammar>
                                                        <profile>false</profile>
                                                        <report>false</report>
                                                        <sourceDirectory>src/main/antlr3</sourceDirectory>
                                                        <trace>true</trace>
                                                        <verbose>true</verbose>
                                                 </configuration>
                                        </execution>
                                </executions>

                        </plugin>
                </plugins>
        </build>
        <pluginRepositories>
                <pluginRepository>
                        <id>tlc</id>
                        <name>TLC Repository</name>
                        <url>http://commons.ucalgary.ca/pub/m2</url>
                </pluginRepository>
        </pluginRepositories>

        <repositories>
                <repository>
                        <id>pds-repo</id>
                        <name>PDS Repository</name>
                        <layout>default</layout>
                        <url>http://pds-cm.jpl.nasa.gov/maven2</url>
                        <releases>
                                <enabled>true</enabled>
                                <updatePolicy>always</updatePolicy>
                                <checksumPolicy>warn</checksumPolicy>
                        </releases>
                        <snapshots>
                                <enabled>false</enabled>
                        </snapshots>
                </repository>
                <repository>
                        <id>ognl-repo</id>
                        <name>OGNL Repository</name>
                        <layout>default</layout>
                        <url>http://mirrors.ibiblio.org/pub/mirrors/maven2</url>
                        <releases>
                                <enabled>true</enabled>
                                <updatePolicy>always</updatePolicy>
                                <checksumPolicy>warn</checksumPolicy>
                        </releases>
                        <snapshots>
                                <enabled>false</enabled>
                        </snapshots>
                </repository>
        </repositories>
        <dependencies>
                <dependency>
                        <groupId>commons-cli</groupId>
                        <artifactId>commons-cli</artifactId>
                        <version>1.2</version>
                        <scope>compile</scope>
                </dependency>
                <dependency>
                        <groupId>commons-io</groupId>
                        <artifactId>commons-io</artifactId>
                        <version>1.4</version>
                        <scope>compile</scope>
                </dependency>
                <dependency>
                        <groupId>commons-lang</groupId>
                        <artifactId>commons-lang</artifactId>
                        <version>2.4</version>
                        <scope>compile</scope>
                </dependency>
                <dependency>
                        <groupId>org.incava</groupId>
                        <artifactId>java-diff</artifactId>
                        <version>1.1.0</version>
                        <scope>compile</scope>
                </dependency>
                <dependency>
                        <groupId>org.antlr</groupId>
                        <artifactId>antlr-runtime</artifactId>
                        <version>3.1.3</version>
                </dependency>
                <dependency>
                        <groupId>org.antlr</groupId>
                        <artifactId>stringtemplate</artifactId>
                        <version>3.2</version>
                </dependency>
                <dependency>
                        <groupId>log4j</groupId>
                        <artifactId>log4j</artifactId>
                        <version>1.2.12</version>
                        <scope>compile</scope>
                </dependency>
                <dependency>
                        <groupId>junit</groupId>
                        <artifactId>junit</artifactId>
                        <version>4.0</version>
                        <type>jar</type>
                        <scope>test</scope>
                        <optional>true</optional>
                </dependency>
                <dependency>
                        <groupId>ognl</groupId>
                        <artifactId>ognl</artifactId>
                        <version>2.7.3</version>
                        <type>jar</type>
                        <scope>compile</scope>
                        <optional>false</optional>
                </dependency>
        </dependencies>
</project>


On 9/27/09 11:48 AM, "Ramirez, Paul M (388J)" <paul.m.ramirez at jpl.nasa.gov> wrote:

Hi All,

I'm having an issue when generating java sources in Maven versus with AntlrWorks. AntlrWorks seems to generate a perfectly fine size parser and lexer but in Maven the source code gets bloated to the point that it won't compile. We are using a helper plugin to compile other source files with the generated sources. Below is the applicable portions of the pom file. I'm hoping it's just a configuration I can change. If there is anything else I could provide to help resolve this issue please let me know.

                        <plugin>
                                <groupId>org.codehaus.mojo</groupId>
                                <artifactId>build-helper-maven-plugin</artifactId>
                                <version>1.0</version>
                                <executions>
                                        <execution>
                                                <id>add-source</id>
                                                <phase>generate-sources</phase>
                                                <goals>
                                                        <goal>add-source</goal>
                                                </goals>
                                                <configuration>
                                                        <sources>
                                                                <source>target/generated-sources/antlr3</source>
                                                        </sources>
                                                </configuration>
                                        </execution>
                                </executions>
                        </plugin>

                        <plugin>
                                <groupId>org.antlr</groupId>
                                <artifactId>antlr3-maven-plugin</artifactId>
                                <version>3.1.3-1</version>

                                <executions>
                                        <execution>
                                                <phase>generate-sources</phase>
                                                <goals>
                                                        <goal>antlr</goal>
                                                </goals>
                                        </execution>
                                </executions>

                        </plugin>

                <dependency>
                        <groupId>org.antlr</groupId>
                        <artifactId>antlr-runtime</artifactId>
                        <version>3.1.3</version>
                </dependency>
                <dependency>
                        <groupId>org.antlr</groupId>
                        <artifactId>stringtemplate</artifactId>
                        <version>3.2</version>
                </dependency>



Thanks,
Paul Ramirez
Senior Computer Scientist
Jet Propulsion Laboratory

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090928/caaf3759/attachment.html 


More information about the antlr-interest mailing list