GWT 2.7.0项目没有用maven gwt编译:compile:注释错误

时间:2016-01-20 14:00:25

标签: eclipse maven gwt gwt-maven-plugin

我创建了一个在Eclipse中运行良好的maven GWT项目。但是,当我在命令行上调用mvn gwt:compile时,我得到了这些错误:

[INFO] Scanning for projects...

[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building de.GWT_App 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- gwt-maven-plugin:2.7.0:compile (default-cli) @ GWT_App ---
[INFO] Compiling module de.GWT_App
[INFO]    Ignored 1 unit with compilation errors in first pass.
[INFO] Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
[INFO]    Resolving de.client.AppPlaceHistoryMapper
[INFO]       Found type 'de.client.AppPlaceHistoryMapper'
[INFO]          Resolving annotation for com.google.gwt.place.shared.WithTokenizers
[INFO]             [WARN] Annotation error: cannot resolve de.client.presenters.login.LoginTokenizer
[INFO]             [ERROR] Annotation error: expected class java.lang.Class, got null
[INFO]    Resolving de.client.proxy.UserProxy
[INFO]       Found type 'de.client.proxy.UserProxy'
[INFO]          Resolving annotation for com.google.web.bindery.requestfactory.shared.ProxyFor
[INFO]             [WARN] Annotation error: cannot resolve de.client.model.User
[INFO]             [WARN] Annotation error: cannot resolve de.client.locator.UserLocator
[INFO]    Resolving de.client.proxy.VeranstaltungProxy
[INFO]       Found type 'de.client.proxy.VeranstaltungProxy'
[INFO]          Resolving annotation for com.google.web.bindery.requestfactory.shared.ProxyFor
[INFO]             [WARN] Annotation error: cannot resolve de.client.model.Veranstaltung
[INFO]    Resolving de.client.requestfactory.UserRequestFactory.UserRequestContext
[INFO]       Found type 'de.client.requestfactory.UserRequestFactory.UserRequestContext'
[INFO]          Resolving annotation for com.google.web.bindery.requestfactory.shared.Service
[INFO]             [WARN] Annotation error: cannot resolve de.client.dao.UserDAOImpl
[INFO]             [WARN] Annotation error: cannot resolve de.client.locator.DAOLocator
[INFO]    Computing all possible rebind results for 'de.client.AppPlaceHistoryMapper'
[INFO]       Rebinding de.client.AppPlaceHistoryMapper
[INFO]          Invoking generator com.google.gwt.place.rebind.PlaceHistoryMapperGenerator
[INFO]             [ERROR] Generator 'com.google.gwt.place.rebind.PlaceHistoryMapperGenerator' threw an exception while rebinding 'de.client.AppPlaceHistoryMapper'
[INFO] java.lang.NullPointerException
[INFO]  at com.google.gwt.place.rebind.PlaceHistoryGeneratorContext.getWithTokenizerEntries(PlaceHistoryGeneratorContext.java:272)
[INFO]  at com.google.gwt.place.rebind.PlaceHistoryGeneratorContext.initTokenizersWithoutGetters(PlaceHistoryGeneratorContext.java:316)
[INFO]  at com.google.gwt.place.rebind.PlaceHistoryGeneratorContext.ensureInitialized(PlaceHistoryGeneratorContext.java:186)
[INFO]  at com.google.gwt.place.rebind.PlaceHistoryGeneratorContext.getPlaceTypes(PlaceHistoryGeneratorContext.java:146)
[INFO]  at com.google.gwt.place.rebind.PlaceHistoryMapperGenerator.writeGetPrefixAndToken(PlaceHistoryMapperGenerator.java:108)
[INFO]  at com.google.gwt.place.rebind.PlaceHistoryMapperGenerator.generateOnce(PlaceHistoryMapperGenerator.java:93)
[INFO]  at com.google.gwt.place.rebind.PlaceHistoryMapperGenerator.generate(PlaceHistoryMapperGenerator.java:56)
[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]  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.JCastOperation.traverse(JCastOperation.java:67)
[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.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]    [ERROR] Errors in 'de/hs_karlsruhe/client/GWT_App.java'
[INFO]       [ERROR] Line 42: Failed to resolve 'de.client.AppPlaceHistoryMapper' via deferred binding
[INFO]    [WARN] For the following type(s), generated source was never committed (did you forget to call commit()?)
[INFO]       [WARN] de.client.AppPlaceHistoryMapperImpl
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 21.497 s
[INFO] Finished at: 2016-01-20T13:20:11+01:00
[INFO] Final Memory: 16M/226M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:gwt-maven-plugin:2.7.0:compile (default-cli) on project GWT_App: Command [[
[ERROR] C:\Java\JDK\jre\bin\java -Xmx512m -classpath D:\Workspace\GWT_App\target\classes;D:\Workspace\GWT_App\src\main\java;D:\Maven_Local_Repository\com\google\gwt\gwt-user\2.7.0
\gwt-user-2.7.0.jar;D:\Maven_Local_Repository\javax\validation\validation-api\1.0.0.GA\validation-api-1.0.0.GA-sources.jar;D:\Maven_Local_Repository\com\google\gwt\gwt-dev\2.7.0\gwt-dev-2.7.0.jar
;D:\Maven_Local_Repository\org\ow2\asm\asm\5.0.3\asm-5.0.3.jar;D:\Maven_Local_Repository\org\ow2\asm\asm-util\5.0.3\asm-util-5.0.3.jar;D:\Maven_Local_Repository\org\ow2\asm\asm-tree\5.0.3\asm-tre
e-5.0.3.jar;D:\Maven_Local_Repository\org\ow2\asm\asm-commons\5.0.3\asm-commons-5.0.3.jar;D:\Maven_Local_Repository\com\google\gwt\gwt-codeserver\2.7.0\gwt-codeserver-2.7.0.jar;D:\Maven_Local_Rep
ository\com\googlecode\mgwt\mgwt\2.0.0\mgwt-2.0.0.jar;D:\Maven_Local_Repository\org\json\json\20151123\json-20151123.jar;D:\Maven_Local_Repository\javax\validation\validation-api\1.0.0.GA\validat
ion-api-1.0.0.GA.jar;D:\Maven_Local_Repository\org\hibernate\hibernate-validator\5.2.2.Final\hibernate-validator-5.2.2.Final.jar;D:\Maven_Local_Repository\org\jboss\logging\jboss-logging\3.2.1.Fi
nal\jboss-logging-3.2.1.Final.jar;D:\Maven_Local_Repository\com\fasterxml\classmate\1.1.0\classmate-1.1.0.jar;D:\Maven_Local_Repository\org\hibernate\hibernate-annotations\3.5.6-Final\hibernate-a
nnotations-3.5.6-Final.jar;D:\Maven_Local_Repository\org\hibernate\hibernate-core\3.5.6-Final\hibernate-core-3.5.6-Final.jar;D:\Maven_Local_Repository\antlr\antlr\2.7.6\antlr-2.7.6.jar;D:\Maven_L
ocal_Repository\commons-collections\commons-collections\3.1\commons-collections-3.1.jar;D:\Maven_Local_Repository\dom4j\dom4j\1.6.1\dom4j-1.6.1.jar;D:\Maven_Local_Repository\xml-apis\xml-apis\1.0
.b2\xml-apis-1.0.b2.jar;D:\Maven_Local_Repository\javax\transaction\jta\1.1\jta-1.1.jar;D:\Maven_Local_Repository\org\hibernate\hibernate-commons-annotations\3.2.0.Final\hibernate-commons-annotat
ions-3.2.0.Final.jar;D:\Maven_Local_Repository\org\hibernate\javax\persistence\hibernate-jpa-2.0-api\1.0.0.Final\hibernate-jpa-2.0-api-1.0.0.Final.jar;D:\Maven_Local_Repository\org\slf4j\slf4j-ap
i\1.5.8\slf4j-api-1.5.8.jar;D:\Maven_Local_Repository\com\google\gwt\inject\gin\2.1.2\gin-2.1.2.jar;D:\Maven_Local_Repository\com\google\inject\guice\3.0\guice-3.0.jar;D:\Maven_Local_Repository\j
avax\inject\javax.inject\1\javax.inject-1.jar;D:\Maven_Local_Repository\aopalliance\aopalliance\1.0\aopalliance-1.0.jar;D:\Maven_Local_Repository\com\google\inject\extensions\guice-assistedinject
\3.0\guice-assistedinject-3.0.jar;D:\Maven_Local_Repository\org\gwtbootstrap3\gwtbootstrap3\0.9.2\gwtbootstrap3-0.9.2.jar;D:\Maven_Local_Repository\com\google\gwt\gwt-user\2.7.0\gwt-user-2.7.0.ja
r;D:\Maven_Local_Repository\javax\validation\validation-api\1.0.0.GA\validation-api-1.0.0.GA.jar;D:\Maven_Local_Repository\javax\validation\validation-api\1.0.0.GA\validation-api-1.0.0.GA-sources
.jar;D:\Maven_Local_Repository\com\google\gwt\gwt-dev\2.7.0\gwt-dev-2.7.0.jar;D:\Maven_Local_Repository\org\ow2\asm\asm\5.0.3\asm-5.0.3.jar;D:\Maven_Local_Repository\org\ow2\asm\asm-util\5.0.3\as
m-util-5.0.3.jar;D:\Maven_Local_Repository\org\ow2\asm\asm-tree\5.0.3\asm-tree-5.0.3.jar;D:\Maven_Local_Repository\org\ow2\asm\asm-commons\5.0.3\asm-commons-5.0.3.jar com.google.gwt.dev.Compiler
-logLevel INFO -style OBF -war D:\Workspace\GWT_App\target\GWT_App-1.0-SNAPSHOT -localWorkers 8 -compileReport -XfragmentCount -1 -sourceLevel 1.7 -extra D:\Workspace\GWT_App\targ
et\extra -gen D:\Workspace\GWT_App\target\.generated de.GWT_App
[ERROR] ]] failed with status 1
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

我已经阅读了有关此内容及其理解方式的其他帖子,它与GWT编译器无法找到类有关。但是,我不了解所提供的解决方案。

有些人说你需要用javac编译类并将它们添加到类路径中。我如何在Eclipse中做到这一点?

其他人说我需要将输出目录从target/classes更改为WEB-INF。我试过了,但每次运行项目时都会清空WEB-INF目录并删除web.xml文件。这肯定不是正确的方法。

我该如何处理?

1 个答案:

答案 0 :(得分:0)

如果您在mvn process-classes阶段没有任何内容,则需要致电mvn compile(或process-classes),然后才能致电mvn gwt:compile

实际上,我会问你为什么要从命令行调用gwt:compile。大多数情况下,您真正​​想要的是mvn prepare-package -DskipTestsmvn package -DskipTests