从源代码构建ANTLR v3.3的问题:antlr3-maven-archetype缺失

时间:2011-06-25 21:20:17

标签: maven antlr

ActionScript target of ANTLR 3.3 is buggy以来,我尝试编译ANTLR 3.3来修复Actionscript运行时目标,如BUILD.txthere中所述。

安装Maven,设置PATH,并按照说明编译ANTLR。

虽然我实际上可以使用mvn创建像gunit这样的子项目,但是我无法构建ANTLR文件夹。

我在ANTLR分发根文件夹中调用mvn,我得到了这个:

[ERROR]     Child module /Users/KKK/Desktop/Neuer Ordner 4/antlr-3 2.3/antlr3-maven-archetype 
            of /Users/KKK/Desktop/Neuer Ordner 4/antlr-3 2.3/pom.xml does not exist

虽然发行版不包含文件夹antlr3-maven-archetype,但它包含一个类似的文件夹antlr3-maven-plugin。

由于BUILD.txt声明构建ANTLR是微不足道的,我想,我忘了执行 一个微不足道的步骤; - )

有人可以帮忙吗?

** UPDATE-1 **

使用以下说明:https://fisheye2.atlassian.com/browse/~raw,r=7250/antlr/BUILD.txt

这是我做的:

下载的Maven

将Maven添加到路径

  export PATH=/Users/sp2/Desktop/antlrtst/maven/bin/:$PATH

在主要分发目录中运行

  mvn -N install

报告这些问题

[WARNING] Some problems were encountered while building the effective model for org.antlr:antlr-master:pom:3.3
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 179, column 21
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. @ line 188, column 21
[WARNING] 'build.plugins.plugin.version' for org.codehaus.mojo:findbugs-maven-plugin is missing. @ line 192, column 21
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-source-plugin is missing. @ line 250, column 14

...但最后报告

BUILD SUCCESS

然后,我执行了这个

mvn -Dmaven.test.skip=true

..开始报告问题

[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.antlr:antlr-runtime:jar:3.3
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. @ org.antlr:antlr-master:3.3, /Users/sp2/.m2/repository/org/antlr/antlr-master/3.3/antlr-master-3.3.pom, line 188, column 21
[WARNING] 'build.plugins.plugin.version' for org.codehaus.mojo:findbugs-maven-plugin is missing. @ line 1, column 3642
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-source-plugin is missing. @ org.antlr:antlr-master:3.3, /Users/sp2/.m2/repository/org/antlr/antlr-master/3.3/antlr-master-3.3.pom, line 250, column 14

...将运行时添加到repo

[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ antlr-runtime ---
[INFO] Installing /Users/sp2/Desktop/antlrtst/antlr-3 2.3/runtime/Java/target/antlr-runtime-3.3.jar to /Users/sp2/.m2/repository/org/antlr/antlr-runtime/3.3/antlr-runtime-3.3.jar
[INFO] Installing /Users/sp2/Desktop/antlrtst/antlr-3 2.3/runtime/Java/pom.xml to /Users/sp2/.m2/repository/org/antlr/antlr-runtime/3.3/antlr-runtime-3.3.pom
[INFO] Installing /Users/sp2/Desktop/antlrtst/antlr-3 2.3/runtime/Java/target/antlr-runtime-3.3-sources.jar to /Users/sp2/.m2/repository/org/antlr/antlr-runtime/3.3/antlr-runtime-3.3-sources.jar

...尝试构建

[INFO] ------------------------------------------------------------------------
[INFO] Building ANTLR Grammar Tool 3.3
[INFO] ------------------------------------------------------------------------

...最终报告此

[INFO] --- antlr-maven-plugin:2.2:generate (default) @ antlr ---
[INFO] grammar [antlr.g] was up-to-date; skipping
[INFO] performing grammar generation [codegen.g]
ANTLR Parser Generator   Version 2.7.7 (20060906)   1989-2005
**error**: file "/Users/sp2/Desktop/antlrtst/antlr-3 2.3/tool/src/main/antlr2/org/antlr/grammar/v2/codegen.g" not found
[INFO] performing grammar generation [antlr.print.g]

......还有这个

    [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ antlr ---
    [INFO] Compiling 97 source files to /Users/sp2/Desktop/antlrtst/antlr-3 2.3/tool/target/classes
    [INFO] -------------------------------------------------------------
    **[ERROR] COMPILATION ERROR :** 
    [INFO] -------------------------------------------------------------
    [ERROR] /Users/sp2/Desktop/antlrtst/antlr-3 2.3/tool/src/main/java/org/antlr/codegen/CodeGenerator.java:[37,27] cannot find symbol
    symbol  : class CodeGenTreeWalker
...

..最后这57个错误之后

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] ANTLR Master build control POM .................... SUCCESS [0.912s]
[INFO] Antlr 3 Runtime ................................... SUCCESS [1.463s]
[INFO] ANTLR Grammar Tool ................................ **FAILURE** [7.275s]
[INFO] Maven plugin for ANTLR V3 ......................... SKIPPED
[INFO] ANTLR gUnit ....................................... SKIPPED
[INFO] Maven plugin for gUnit ANTLR V3 ................... SKIPPED
[INFO] ------------------------------------------------------------------------

太糟糕了。我真的很想知道,为什么这些东西往往会那么复杂......

1 个答案:

答案 0 :(得分:1)

自己试了一下。得到了同样的错误。

在父pom.xml

中评论了违规模块
 <!--module>antlr3-maven-archetype</module-->

成功建造。

不确定您的要求,但希望您仍然可以通过此解决方法实现此目标。

编辑1 :您可以安全地忽略所有警告(与版本相关),这些警告是由于使用maven3运行maven2 pom而引起的。

但是你不应该收到这个错误:

  

错误:文件“/ Users / sp2 / Desktop / antlrtst / antlr-3   2.3 /工具/ src目录/主/ antlr2 /组织/ ANTLR /语法/ V2 / codegen.g”   找不到

此文件存在于源代码分发中。有趣的是,您的文件夹显示“antlr-3.2.3”,而其他消息则与3.3相关。可能是你有不正确/缺少的来源吗?