antlr / antlr4

ANTLR (ANother Tool for Language Recognition) is a powerful parser generator for reading, processing, executing, or translating structured text or binary files.
http://antlr.org
BSD 3-Clause "New" or "Revised" License
16.99k stars 3.26k forks source link

generate javascript and java by maven #2943

Open quantrpeter opened 3 years ago

quantrpeter commented 3 years ago

Hi I have a maven project which generate the antlr classes in java. Now i want to generate js too, how can i do it? It seems in pom.xml only support one , tried to add one more, it gives me : 'build.plugins.plugin.(groupId:artifactId)' must be unique but found duplicate declaration of plugin org.antlr:antlr4-maven-plugin

            <plugin>
                <groupId>org.antlr</groupId>
                <artifactId>antlr4-maven-plugin</artifactId>
                <version>4.8-1</version>
                <executions>
                    <execution>
                        <id>antlr</id>
                        <goals>
                            <goal>antlr4</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <sourceDirectory>${basedir}/src/main/java/hk/quantr/vcd/antlr</sourceDirectory>
                    <outputDirectory>${project.build.directory}/generated-sources/antlr4/hk/quantr/vcd/antlr</outputDirectory>
                    <arguments>
                        <argument>-package</argument>
                        <argument>hk.quantr.vcd.antlr</argument>
                    </arguments>
                    <listener>true</listener>
                </configuration>
            </plugin>

thanks Peter

ericvergnaud commented 3 years ago

Hi, please move this to the google discussion group. Eric

KvanTTT commented 3 years ago

Maybe not only JavaScript but all available runtimes.

electrum commented 3 years ago

You can have multiple <execution> blocks for a single plugin, each with their own <configuration> (put it inside <execution> instead of outside). The outer <configuration> applies to all executions.