我正试图从源代码构建ANTLR版本4,因为我是从官方网站下载的,但是我不能用ant来做。我在build.xml中将antlr-3.5-complete-no-st3.jar下载到/ lib文件夹,但是当我运行ant时它返回:
[mkdir]创建目录:/../antlr /antlr4-master/build/generated-sources/antlr3/org/antlr/v4/parse [java]错误(7):无法找到或打开文件:* .g
建立失败 /../antlr/antlr4-master/build.xml:108:执行此行时发生以下错误: /../antlr/antlr4-master/build.xml:84:Java返回:1
我在运行OSX 10.8.2的MacBook上 为了使用ant成功编译,我还有什么需要做的吗?
提前致谢, DIMOS
答案 0 :(得分:2)
您需要使用Maven从源代码构建ANTLR。
答案 1 :(得分:0)
上面“使用Maven构建ANTLR 4”链接似乎不可用。请按照以下链接进行ANTLR 4 maven构建。这些帮助我实现了antlr 4 maven构建。
https://groups.google.com/forum/#!msg/antlr-discussion/Vw4Ia__sgPk/nDS5Y9YSDGIJ
How do I get help on the antlr4-maven-plugin
我的ANTLR-Maven插件如下: -
<build>
<plugins>
<plugin>
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
<version>4.0</version>
<configuration>
<sourceDirectory>${basedir}/src/main/java/com/test</sourceDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>antlr4</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.antlr</groupId>
<artifactId>
antlr4-maven-plugin
</artifactId>
<versionRange>
[4.0,)
</versionRange>
<goals>
<goal>antlr4</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
<version>4.2.2</version>
</dependency>
</dependencies>