2

给定由以下人员生成的 Maven 项目:

mvn archetype:generate -B -DarchetypeGroupId=org.antlr \
  -DarchetypeArtifactId=antlr3-maven-archetype \
  -DarchetypeVersion=3.2 \
  -DgroupId=com.yourcompany \
  -DartifactId=yourproject \
  -Dversion=yourversion \
  -Dpackage=com.yourcompany.package.path

cf:http ://www.antlr.org/wiki/display/ANTLR3/Building+ANTLR+Projects+with+Maven

有这样的架构:

.
|-- pom.xml
`-- src
    `-- main
        |-- antlr3
        |   |-- com
        |   |   `-- yourcompany
        |   |       `-- package
        |   |           `-- path
        |   |               |-- TLexer.g
        |   |               |-- TParser.g
        |   |               `-- TTree.g
        |   `-- imports
        |       `-- Ruleb.g
        `-- java
            `-- com
                `-- yourcompany
                    `-- package
                        `-- path
                            |-- AbstractTLexer.java
                            |-- AbstractTParser.java
                            `-- Main.java

通过将 maven-gunit-plugin 添加到 pom :

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

GUNIT 文件应该在哪里?

更新(已经)

我不是在谈论 Junit 集成(但是,如果这是唯一的方法,我肯定会选择这个)。

4

1 回答 1

1

来源的相关部分告诉我它使用 ${basedir}/src/test/gunit。对于文件,它使用私有变量包含或 * / .testsuite 如果包含未定义。maven-gunit-plugin 似乎无法处理 JUnit 与 3.2 的集成。

于 2010-10-01T19:11:29.477 回答