[antlr-interest] maven plugin, grammars for testing

Espák Miklós espakm at gmail.com
Thu Oct 15 01:49:56 PDT 2009


Hi,

I created a grammar that allows writing simple tests for a term rewriting
system.
I placed the grammar under src/test/antlr3/<my package>/ .

This directory is not processed by the antlr3 plugin by default, so I added
a new execution to the plugin, specifying the the source directory mentioned
above. The sources are generated to target/generated-sources.

The problem is that this directory is not in the source path of the compiler
plugin at the test-compile phase. I also tried to set the outputDirectory to
target/generated-test-sources, but nothing changed. The source path
contained only src/test/java and I did not find any way to add another
directory to it.

The only solution was to set the output directory to src/test/java what is
not a nice solution.

      <plugin>
        <groupId>org.antlr</groupId>
        <artifactId>antlr3-maven-plugin</artifactId>
          <executions>
            <execution>
              <id>default</id>
              <goals>
                <goal>antlr</goal>
              </goals>
            </execution>
            <execution>
              <id>test</id>
              <phase>generate-test-sources</phase>
              <goals>
                <goal>antlr</goal>
              </goals>
              <configuration>
                <sourceDirectory>src/test/antlr3</sourceDirectory>

<!--outputDirectory>target/generated-sources</outputDirectory-->

<!--outputDirectory>target/generated-test-sources</outputDirectory-->
                <outputDirectory>src/test/java</outputDirectory>
              </configuration>
            </execution>
          </executions>
      </plugin>

Is it possible to add target/generated-test-sources directory to the source
path of the compiler plugin for the test-compile phase?

I think, it would be a comfortable default behaviour if the plugin would
process src/test/antlr3 by default and it would generate sources under
target/generated-test-sources. (If there is a way to add that directory to
the source path of the compiler.)

Thanks,
Miklos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20091015/d27bef3d/attachment.html 


More information about the antlr-interest mailing list