Как получить помощь по antlr4-maven-plugin

Плагин antlr4-maven не является документом на веб-сайте Antlr4.


person lexicalscope    schedule 10.03.2013    source источник


Ответы (6)


Это может ничего вам не дать, как и мне. Попробуй это:

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] ------------------------------------------------------------------------
person TomEE    schedule 03.07.2013
comment
Вы просто показываете вывод, я не уверен, что назвал бы это ответом. - person glts; 03.07.2013
comment
+1 за включение полной команды, которая требуется, если вы еще не загрузили артефакты antlr4. - person Rangi Keen; 13.01.2014

Вот две ссылки, которые помогут прямо сейчас:

Мы работаем над размещением документации сайта 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>
person Sam Harwell    schedule 08.07.2013

Плагин antlr4-maven-plugin имеет цель справки, которую можно выполнить с помощью maven следующим образом:

mvn antlr4:help -Ddetail=true
person lexicalscope    schedule 10.03.2013
comment
Обратите внимание, что это будет работать только в том случае, если вы уже загрузили соответствующие артефакты. Ответ @TomEE будет работать в первый раз, а затем будет работать и при последующих вызовах. - person Rangi Keen; 13.01.2014

Помощь ограничена, но (в дополнение к другим ответам на эти вопросы) я нашел следующие полезные места:

person Rangi Keen    schedule 14.01.2014

Вы также можете просмотреть следующий блог, в котором описаны оба плагина для генерации и тестирования грамматик ANTLR 4.

person codelion    schedule 16.03.2015

Похоже, сайт плагина maven теперь опубликован:

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

person karlgold    schedule 31.05.2014