【问题标题】:How do I get help on the antlr4-maven-plugin如何获得有关 antlr4-maven-plugin 的帮助
【发布时间】:2013-03-10 16:52:42
【问题描述】:

antlr4-maven-plugin 似乎没有出现在 Antlr4 网站上。

【问题讨论】:

    标签: antlr4


    【解决方案1】:

    这可能什么也得不到,就像我一样。试试这个:

    mvn org.antlr:antlr4-maven-plugin:help -Ddetail=true
    

    生产:

    [INFO] Scanning for projects...
    [INFO]                                                                         
    [INFO] ------------------------------------------------------------------------
    [INFO] Building Maven Stub Project (No POM) 1
    [INFO] ------------------------------------------------------------------------
    [INFO] 
    [INFO] --- antlr4-maven-plugin:4.0:help (default-cli) @ standalone-pom ---
    [INFO] ANTLR 4 Maven plugin 4.0
    Maven plugin for ANTLR 4 grammars
    
    This plugin has 2 goals:
    
    antlr4:antlr4
    Parses ANTLR 4 grammar files *.g4 and transforms them into Java source files.
    
    Available parameters:
    
    arguments
      A list of additional command line arguments to pass to the ANTLR tool.
    
    atn
      If set to true then the ANTLR tool will generate a description of the ATN
      for each rule in Dot format.
    
    encoding
      specify grammar file encoding; e.g., euc-jp
    
    excludes
      A set of Ant-like exclusion patterns used to prevent certain files from
      being processed. By default, this set is empty such that no files are
      excluded.
    
    forceATN
      Use the ATN simulator for all predictions.
    
    includes
      Provides an explicit list of all the grammars that should be included in
      the generate phase of the plugin. Note that the plugin is smart enough to
      realize that imported grammars should be included but not acted upon
      directly by the ANTLR Tool. A set of Ant-like inclusion patterns used to
      select files from the source directory for processing. By default, the
      pattern **/*.g4 is used to select grammar files.
    
    libDirectory
      Specify location of imported grammars and tokens files.
    
    listener
      Generate parse tree listener interface and base class.
    
    options
      A list of grammar options to explicitly specify to the tool. These options
      are passed to the tool using the -D<option>=<value> syntax.
    
    outputDirectory
      Specify output directory where the Java files are generated.
    
    sourceDirectory
      The directory where the ANTLR grammar files (*.g4) are located.
    
    treatWarningsAsErrors
      Treat warnings as errors.
    
    visitor
      Generate parse tree visitor interface and base class.
    
    antlr4:help
    Display help information on antlr4-maven-plugin.
    Call mvn antlr4:help -Ddetail=true -Dgoal=<goal-name> to display parameter
    details.
    
    Available parameters:
    
    detail
      If true, display all settable properties for each goal.
    
    goal
      The name of the goal for which to show help. If unspecified, all goals
      will be displayed.
    
    indentSize
      The number of spaces per indentation level, should be positive.
    
    lineLength
      The maximum length of a display line, should be positive.
    
    
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 0.635s
    [INFO] Finished at: Wed Jul 03 14:52:12 EDT 2013
    [INFO] Final Memory: 3M/81M
    [INFO] ------------------------------------------------------------------------
    

    【讨论】:

    • 你只是在显示输出,我不确定我会称之为答案。
    • +1 用于包含您尚未下载 antlr4 工件时所需的完全限定命令。
    【解决方案2】:

    这里有两个链接可以帮助你:

    我们正在努力让 Maven 站点文档在线托管。


    我将语法放在与 Java 文件相同的文件夹中(在我希望生成的代码出现的包中)。

    因为我像这样在顶层声明我的源目录:

    <build>
      <sourceDirectory>src</sourceDirectory>
    </build>
    

    我会为 ANTLR 4 Maven 插件使用以下配置:

    <plugin>
        <groupId>org.antlr</groupId>
        <artifactId>antlr4-maven-plugin</artifactId>
        <version>4.0</version>
        <configuration>
            <sourceDirectory>${basedir}/src</sourceDirectory>
        </configuration>
        <executions>
            <execution>
                <goals>
                    <goal>antlr4</goal>
                </goals>
            </execution>
        </executions>
    </plugin>
    

    【讨论】:

      【解决方案3】:

      antlr4-maven-plugin 有一个帮助目标,可以使用 maven 执行,如下所示:

      mvn antlr4:help -Ddetail=true
      

      【讨论】:

      • 请注意,这只有在您已经下载了相应的工件时才有效。 @TomEE 的答案将在第一次起作用,然后在后续调用中起作用。
      【解决方案4】:

      帮助有限,但(除了此问题的其他答案)我发现以下地方很有用:

      【讨论】:

        【解决方案5】:

        您还可以查看following blog,它描述了用于生成和测试 ANTLR 4 语法的两个插件。

        【讨论】:

          【解决方案6】:

          看起来 maven 插件站点现已发布:

          http://www.antlr.org/api/maven-plugin/latest/index.html

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2011-01-30
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多