Ver*_*tex 14 eclipse maven antlr4
我是ANTLR4的新手,似乎没有针对v4的Eclipse-Plug-In.因此,从.g4语法自动构建Java源代码会很好.我有一个简单的空Maven项目,带有src/main/java,src/test/java.在哪里放置.g4文件?如何使用Maven自动构建语法?
我自己的POM测试失败了:
<repository>
<id>mvn-public</id>
<name>MVNRepository</name>
<url>http://mvnrepository.com</url>
</repository>
...
<build>
<plugins>
<plugin>
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
<version>4.0.0</version>
<executions>
<execution>
<goals>
<goal>antlr</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
Eclipse说:
Failure to find org.antlr:antlr4-maven-plugin:pom:4.0.0 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of
central has elapsed or updates are forced
Run Code Online (Sandbox Code Playgroud)
Sam*_*ell 17
我创建了以下Gist,其pom.xml设计仅用于支持在Eclipse构建期间从ANTLR 4语法生成自动代码.它包含m2e的必要生命周期信息,以便知道代码生成是必要的,并使用build-helper-maven-pluginEclipse 显式添加代码生成文件夹,因为Eclipse似乎在查找它时遇到一些麻烦.
在此配置中,语法文件(*.g4)与其他Java源文件一起放置.Maven插件会自动package ...为生成的文件添加正确的语句,因此您不应@header{package ...}在语法本身中包含一行.
https://gist.github.com/sharwell/4979017
| 归档时间: |
|
| 查看次数: |
11612 次 |
| 最近记录: |