2014-12-07 50 views
0

我遇到了使用maven编译GWT项目的异常,但它在eclipse中工作。我花了最近几个小时的搜索和搜索StackOverflow,但有几个结果是相关的,但没有一个适合我的情况。GWT编译使用maven而不是eclipse - NoSuchMethodError UiBinderWriter失败。 <init>

环境:

  • OSX 10.10.1
  • 爪哇1.7.0_67 64位
  • GWT 2.7.0
  • GWTP 1.3.1
  • GAE 1.9.17
  • Maven的3.2.3

我可以r un使用超级开发模式在eclipse中的项目,它工作正常。我可以使用Eclipse GWT插件来编译项目 - 它成功完成。但是,如果我尝试通过使用mvn clean compile gwt:compile终端编译,我得到以下错误:

[INFO] Compiling module com.example.foo.Foo 
[INFO] [ERROR] An internal compiler exception occurred 
[INFO] com.google.gwt.dev.jjs.InternalCompilerException: Unexpected error during visit. 
[INFO] at com.google.gwt.dev.jjs.ast.JVisitor.translateException(JVisitor.java:121) 
[INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:296) 
[INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:285) 
[INFO] at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:128) 
[INFO] at com.google.gwt.dev.jjs.ast.JDeclarationStatement.traverse(JDeclarationStatement.java:49) 
[INFO] at com.google.gwt.dev.jjs.ast.JModVisitor$ListContext.traverse(JModVisitor.java:95) 
[INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.acceptWithInsertRemove(JModVisitor.java:351) 
[INFO] at com.google.gwt.dev.jjs.ast.JBlock.traverse(JBlock.java:92) 
[INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:381) 
[INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:293) 
[INFO] at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:149) 
[INFO] at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:145) 
[INFO] at com.google.gwt.dev.jjs.ast.JMethodBody.traverse(JMethodBody.java:83) 
[INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:381) 
[INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:293) 
[INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:285) 
[INFO] at com.google.gwt.dev.jjs.ast.JMethod.visitChildren(JMethod.java:600) 
[INFO] at com.google.gwt.dev.jjs.ast.JMethod.traverse(JMethod.java:569) 
[INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:381) 
[INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:293) 
[INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:285) 
[INFO] at com.google.gwt.dev.jjs.impl.UnifyAst.mainLoop(UnifyAst.java:1505) 
[INFO] at com.google.gwt.dev.jjs.impl.UnifyAst.exec(UnifyAst.java:870) 
[INFO] at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler$Precompiler.unifyJavaAst(JavaToJavaScriptCompiler.java:1305) 
[INFO] at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler$Precompiler.constructJavaAst(JavaToJavaScriptCompiler.java:1038) 
[INFO] at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler$Precompiler.precompile(JavaToJavaScriptCompiler.java:954) 
[INFO] at com.google.gwt.dev.jjs.MonolithicJavaToJavaScriptCompiler.precompile(MonolithicJavaToJavaScriptCompiler.java:303) 
[INFO] at com.google.gwt.dev.jjs.JavaScriptCompiler.precompile(JavaScriptCompiler.java:38) 
[INFO] at com.google.gwt.dev.Precompile.precompile(Precompile.java:286) 
[INFO] at com.google.gwt.dev.Precompile.precompile(Precompile.java:229) 
[INFO] at com.google.gwt.dev.Precompile.precompile(Precompile.java:145) 
[INFO] at com.google.gwt.dev.Compiler.run(Compiler.java:206) 
[INFO] at com.google.gwt.dev.Compiler.run(Compiler.java:158) 
[INFO] at com.google.gwt.dev.Compiler$1.run(Compiler.java:120) 
[INFO] at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:55) 
[INFO] at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:50) 
[INFO] at com.google.gwt.dev.Compiler.main(Compiler.java:127) 
[INFO] Caused by: java.lang.NoSuchMethodError: com.google.gwt.uibinder.rebind.UiBinderWriter.<init>(Lcom/google/gwt/core/ext/typeinfo/JClassType;Ljava/lang/String;Ljava/lang/String;Lcom/google/gwt/core/ext/typeinfo/TypeOracle;Lcom/google/gwt/uibinder/rebind/MortalLogger;Lcom/google/gwt/uibinder/rebind/FieldManager;Lcom/google/gwt/uibinder/rebind/messages/MessagesWriter;Lcom/google/gwt/uibinder/rebind/DesignTimeUtils;Lcom/google/gwt/uibinder/rebind/UiBinderContext;ZZLjava/lang/String;)V 
[INFO] at com.google.gwt.uibinder.rebind.UiBinderGenerator.generateOnce(UiBinderGenerator.java:187) 
[INFO] at com.google.gwt.uibinder.rebind.UiBinderGenerator.generate(UiBinderGenerator.java:135) 
[INFO] at com.google.gwt.core.ext.IncrementalGenerator.generateNonIncrementally(IncrementalGenerator.java:40) 
[INFO] at com.google.gwt.dev.javac.StandardGeneratorContext.runGeneratorIncrementally(StandardGeneratorContext.java:760) 
[INFO] at com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:160) 
[INFO] at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOracle.java:79) 
[INFO] at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:276) 
[INFO] at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:265) 
[INFO] at com.google.gwt.dev.DistillerRebindPermutationOracle.getAllPossibleRebindAnswers(DistillerRebindPermutationOracle.java:87) 
[INFO] at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.createStaticRebindExpression(UnifyAst.java:485) 
[INFO] at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.createRebindExpression(UnifyAst.java:443) 
[INFO] at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.handleMagicMethodCall(UnifyAst.java:576) 
[INFO] at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.endVisit(UnifyAst.java:306) 
[INFO] at com.google.gwt.dev.jjs.ast.JMethodCall.traverse(JMethodCall.java:248) 
[INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:381) 
[INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:293) 
[INFO] ... 35 more 
[INFO]  [ERROR] at com_gwtplatform_mvp_client_DesktopGinjector_DesktopGinjectorGinjector_fragment.java(91): GWT.create(ApplicationView$Binder.class) 
[INFO]   com.google.gwt.dev.jjs.ast.JMethodCall 
[INFO]  [ERROR] at com_gwtplatform_mvp_client_DesktopGinjector_DesktopGinjectorGinjector_fragment.java(91): Object created = GWT.create(ApplicationView$Binder.class) 
[INFO]   com.google.gwt.dev.jjs.ast.JDeclarationStatement 
[INFO]  [ERROR] at com_gwtplatform_mvp_client_DesktopGinjector_DesktopGinjectorGinjector_fragment.java(90): { 
[INFO] Object created = GWT.create(ApplicationView$Binder.class); 
[INFO] assert created instanceof ApplicationView$Binder; 
[INFO] ApplicationView$Binder result = (ApplicationView$Binder) created; 
[INFO] this.memberInject_Key$type$com$example$foo$client$application$ApplicationView$Binder$_annotation$$none$$(result); 
[INFO] return result; 
[INFO] } 
[INFO]   com.google.gwt.dev.jjs.ast.JBlock 
[INFO]  [ERROR] at com_gwtplatform_mvp_client_DesktopGinjector_DesktopGinjectorGinjector_fragment.java(90): { 
[INFO] Object created = GWT.create(ApplicationView$Binder.class); 
[INFO] assert created instanceof ApplicationView$Binder; 
[INFO] ApplicationView$Binder result = (ApplicationView$Binder) created; 
[INFO] this.memberInject_Key$type$com$example$foo$client$application$ApplicationView$Binder$_annotation$$none$$(result); 
[INFO] return result; 
[INFO] } 
[INFO]   com.google.gwt.dev.jjs.ast.JMethodBody 
[INFO]  [ERROR] at com_gwtplatform_mvp_client_DesktopGinjector_DesktopGinjectorGinjector_fragment.java(90): public ApplicationView$Binder get_Key$type$com$example$foo$client$application$ApplicationView$Binder$_annotation$$none$$(); 
[INFO] 
[INFO]   com.google.gwt.dev.jjs.ast.JMethod 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 14.013 s 
[INFO] Finished at: 2014-12-06T20:28:36-05:00 
[INFO] Final Memory: 13M/310M 
[INFO] ------------------------------------------------------------------------ 

我用GWTP插件生成对谷歌应用程序引擎使用的基础工程,而不得不调整一些东西以获得它,以便它能在本地工作并推送到应用程序引擎。它在当时编译得很好,日食或maven。我做了一些修改,主要是搞UI和GWT日志记录,在超级开发模式下进行测试,并且它运行良好。现在工作正常。由于没有完成,我没有尝试上传到GAE。

研究:

一位参与inherited modules这是压倒一切的GWT UiBinder的实现,但我没有加入或继承依赖从我用来生成它的原型。另外,它通过eclipse/SuperDevMode工作。 other是关于在eclipse中编译工作的,我可能用它在一周前第一次工作时得到eclipse的工作。但它在eclipse中工作,但不通过maven命令行。

我试过去掉gwt/gwtp不需要的各种模块,但都没有运气。我指定了一个gwt-user和gwt-dev导入版本,没有任何东西。我总是得到同样的错误,这让我很生气!我只是无法弄清楚为什么它不会用'普通'的maven编译。

+1

如果某些依赖项“隐藏”了com.google.gwt.uibinder.rebind.UiBinderWriter类,那么它必定是类路径排序问题。要么你改变了你的Maven版本,并且以不同的顺序依赖,或者你改变了'pom.xml'中的依赖声明顺序。尝试在Eclipse中使用“open type”来查找包含违规的过期类的依赖项,并尝试使用与GWT 2.7兼容的一个更新依赖项(和/或重新排序POM) – 2014-12-07 02:16:49

+0

您是对的 - 它是依赖性顺序。我不记得改变它,但我通过重新排序依赖来修复它。也就是说,我将gwt-user移动到列表的前面,问题就消失了。谢谢! – 2014-12-09 20:06:32

回答

0

问题是,我的其他依赖之一是'遮蔽'我需要的UIBinder,正如托马斯 - 布鲁耶指出的那样。我不确定它何时发生变化,我不记得移动任何依赖关系。也许这是某个地方的传递依赖。在任何情况下,我解决了...

添加/移动gwt用户依赖项到列表的前面。问题解决了!

1

GWTP覆盖UiBinderGenerator以允许杜松子酒与UiBinder协同工作。将GWTP的版本更改为1.4-SNAPSHOT(1.4应该很快就会发布!),它应该解决这个问题,因为我们将UiBinderGenerator移至扩展而不是核心MVP框架的一部分。与Thomas一起工作的原因可能是类路径排序问题,就像Thomas Broyer指出的那样。

+0

在这种情况下,它不是GWTP相关的,但它绝对是要注意的东西 – 2014-12-09 20:07:12