How to generate JUnit sources using maven-gunit-plugin

I have maven configured to run gunit (ANTLR grammar testing tool) via maven-gunit-plugin . gunit, however, has two different modes. The first mode forces gunit to act as an interpreter, viewing the * .gunit (or * .testsuite) file, interpreting it and displaying the results. It can be configured as such:

  <plugin>
    <groupId>org.antlr</groupId>
    <artifactId>maven-gunit-plugin</artifactId>
    <version>3.1.3</version>
    <executions>
        <execution>
            <id>maven-gunit-plugin</id>
            <phase>test</phase>
            <goals>
                <goal>gunit</goal>
            </goals>
        </execution>
    </executions>
  </plugin>

The second mode causes gunit to generate source code that can be run by JUnit. How can I tell the maven-gunit plugin to generate JUnit sources instead of acting as an interpreter?

A few notes:

EDIT/RESOLUTION:

ANTLR, maven-gunit. junit. , - fire-maven- exec.

+3
2

MNG-4039, maven-gunit-plugin gunit-maven-plugin. , , , - :

<dependencies>
  <dependency>
    <groupId>org.antlr</groupId>
    <artifactId>antlr-runtime</artifactId>
    <version>3.1.1</version>
  </dependency>
  <!-- Here is the 'extra' dep -->
  <dependency>
    <groupId>org.antlr</groupId>
    <artifactId>antlr</artifactId>
    <version>3.1.1</version>
    <!-- we try to use scope to hide it from transitivity -->
    <scope>test</scope> <!-- or perhaps 'provided' (see later discussion) or 'import' (maven >= 2.0.9) -->
  </dependency>
</dependencies>
<build>
  <plugins>
    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>gunit-maven-plugin</artifactId>
      <version>1.0.0-SNAPSHOT</version>
      <executions>
        <execution>
          <goals>
            <goal>generate</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

, . , , SNAPSHOT. , , , "" maven-gunit-plugin.

+3

, GUnit- ( JUnit GUnit) maven . Jim Idle concering GUnit
antlr3-maven-plugin , maven-plugin .

, , .

+1

Source: https://habr.com/ru/post/1718756/


All Articles