antlr / antlr4test-maven-plugin

A maven plugin used to test the grammars-v4 repo grammars
BSD 3-Clause "New" or "Revised" License
17 stars 16 forks source link

Using this plugin with a jar in the classpath or maven dependency #10

Closed luyseyal closed 6 years ago

luyseyal commented 6 years ago

Error I'm getting:

baseDir: /tmp/testproject
exampleFiles: src/main/plsql/
Lexer classname is: PlSqlLexer
Parser classname is: PlSqlParser
java.lang.ClassNotFoundException: PlSqlLexer

I'm building an internal project with pom.xml like this and I'm wondering how to get a Lexer/Parser into the classpath of the test.

(We are building the standard PL/SQL grammar/lexer jar internally and uploading to an internal maven repo, thus the dependency below...)

  <build>
    <plugins>
      <plugin>
        <groupId>com.khubla.antlr</groupId>
        <artifactId>antlr4test-maven-plugin</artifactId>
        <version>1.9</version>
        <configuration>
          <verbose>true</verbose>
          <showTree>false</showTree>
          <entryPoint>sql_script</entryPoint>
          <grammarName>PlSql</grammarName>
          <caseInsensitiveType>UPPER</caseInsensitiveType>
          <packageName></packageName>
          <exampleFiles>src/main/plsql/</exampleFiles>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>test</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <dependencies>
    <dependency>
      <groupId>com.antlr.grammarsv4</groupId>
      <artifactId>plsql</artifactId>
      <version>1.0-SNAPSHOT</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

Thank you for your time,

Stephen

luyseyal commented 6 years ago

I figured it out, I needed to move the dependencies block into the plugin.

  <build>
    <plugins>
      <plugin>
        <groupId>com.khubla.antlr</groupId>
        <artifactId>antlr4test-maven-plugin</artifactId>
        <version>1.9</version>
        <configuration>
          <verbose>false</verbose>
          <showTree>false</showTree>
          <entryPoint>sql_script</entryPoint>
          <grammarName>PlSql</grammarName>
          <caseInsensitiveType>UPPER</caseInsensitiveType>
          <packageName></packageName>
          <exampleFiles>src/main/plsql/</exampleFiles>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>test</goal>
            </goals>
          </execution>
        </executions>
        <dependencies>
          <dependency>
          <groupId>com.antlr.grammarsv4</groupId>
          <artifactId>plsql</artifactId>
          <version>1.0-SNAPSHOT</version>
        </dependency>
        </dependencies>
      </plugin>
    </plugins>
  </build>