Das antlr4-maven-plugin scheint kein Dokument auf der Antlr4-Website zu sein.Wie bekomme ich Hilfe zum antilr4-maven-plugin
Antwort
Dass Sie nichts bekommen könnte, wie es mir angetan hat. Versuchen Sie folgendes:
mvn org.antlr:antlr4-maven-plugin:help -Ddetail=true
Produziert:
[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] ------------------------------------------------------------------------
Die antlr4-Maven-Plugin verfügt über eine Hilfe Ziel, die ausgeführt werden können, Maven verwenden, wie folgt aus:
mvn antlr4:help -Ddetail=true
Beachten Sie, dass dies nur funktioniert, wenn Sie die entsprechenden Artefakte bereits heruntergeladen haben. @ TomEE's Antwort wird beim ersten Mal funktionieren und dann wird sie bei nachfolgenden Anrufen funktionieren. –
Hier sind zwei Links jetzt helfen:
- (For Maven users) ANTLR4 Maven Project Setup
- (For Eclipse users) How to automatically generate lexer+parser with ANTLR4 and Maven?
Wir sind arbeiten, um die Maven-Website-Dokumentation online gehostet zu bekommen.
ich meine Grammatiken in den gleichen Ordner wie die Java-Dateien (in dem Paket, in dem ich der generierte Code angezeigt werden soll) platzieren.
Da ich meine Quellverzeichnis auf der obersten Ebene wie folgt erklären:
<build>
<sourceDirectory>src</sourceDirectory>
</build>
würde ich die folgende Konfiguration für die ANTLR 4 Maven Plugin verwenden:
<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>
Hilfe ist begrenzt, aber (Zusätzlich zu den anderen Antworten auf diese Fragen) fand ich die folgenden Orte nützlich:
- GitHub abntlr4-maven-plugin documentation site (erscheint die maßgebliche Dokumentation und enthält Beispiele zu sein)
- ANTLR4 Wiki - Java IDE Integration (der MVN Abschnitt am Boden hat einige grundlegende Informationen)
wie das Maven Plugin Seite sieht nun veröffentlicht:
Sie können auch die following blog überprüfen, die beide Plugins zum Generieren und Testen von ANTLR 4 Grammatiken beschreibt.
Sie zeigen nur die Ausgabe, ich bin mir nicht sicher, ob ich das eine Antwort nennen würde. – glts
+1 für die Aufnahme des vollständig qualifizierten Befehls, der erforderlich ist, wenn Sie die Artefakte von antlr4 noch nicht heruntergeladen haben. –