我在尝试运行构建以生成gwtp应用程序的war文件时出错。错误如下:
> gwtc:
[java] Loading inherited module 'com.google.gwt.user.User'
[java] Loading inherited module 'com.google.gwt.core.Core'
[java] Loading inherited module 'com.google.gwt.core.CompilerParameters'
[java] [WARN] Setting configuration property named compiler.max.vars.per.var in com.google.gwt.core.CompilerParameters that has not been previously defined. This may be disallowed in the future.
[java] Loading inherited module 'com.google.gwt.resources.Resources'
[java] [ERROR] Unable to find 'com/google/gwt/resources/Resources.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
[java] [ERROR] Line 6: Unexpected exception while processing element 'inherits'
[java] com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
[java] at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:239)
[java] at com.google.gwt.dev.cfg.ModuleDefSchema$BodySchema.__inherits_begin(ModuleDefSchema.java:354)
[java] at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[java] at java.lang.reflect.Method.invoke(Method.java:606)
[java] at com.google.gwt.dev.util.xml.HandlerMethod.invokeBegin(HandlerMethod.java:223)
[java] at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.startElement(ReflectiveParser.java:270)
[java] at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
[java] at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182)
[java] at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1342)
[java] at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2770)
[java] at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
[java] at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
[java] at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
[java] at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
[java] at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
[java] at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
[java] at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:648)
[java] at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.parse(ReflectiveParser.java:327)
[java] at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.access$100(ReflectiveParser.java:48)
[java] at com.google.gwt.dev.util.xml.ReflectiveParser.parse(ReflectiveParser.java:398)
[java] at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:257)
[java] at com.google.gwt.dev.cfg.ModuleDefLoader$1.load(ModuleDefLoader.java:169)
[java] at com.google.gwt.dev.cfg.ModuleDefLoader.doLoadModule(ModuleDefLoader.java:283)
[java] at com.google.gwt.dev.cfg.ModuleDefLoader.loadFromClassPath(ModuleDefLoader.java:141)
[java] at com.google.gwt.dev.Compiler.run(Compiler.java:184)
[java] at com.google.gwt.dev.Compiler$1.run(Compiler.java:152)
[java] at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:87)
[java] at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:81)
[java] at com.google.gwt.dev.Compiler.main(Compiler.java:159)
[java] [ERROR] Failure while parsing XML
[java] com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
[java] at com.google.gwt.dev.util.xml.DefaultSchema.onHandlerException(DefaultSchema.java:56)
[java] at com.google.gwt.dev.util.xml.Schema.onHandlerException(Schema.java:66)
[java] at com.google.gwt.dev.util.xml.Schema.onHandlerException(Schema.java:66)
[java] at com.google.gwt.dev.util.xml.HandlerMethod.invokeBegin(HandlerMethod.java:233)
[java] at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.startElement(ReflectiveParser.java:270)
[java] at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
[java] at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182)
[java] at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1342)
[java] at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2770)
[java] at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
[java] at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
[java] at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
[java] at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
[java] at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
[java] at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
[java] at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:648)
[java] at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.parse(ReflectiveParser.java:327)
[java] at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.access$100(ReflectiveParser.java:48)
[java] at com.google.gwt.dev.util.xml.ReflectiveParser.parse(ReflectiveParser.java:398)
[java] at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:257)
[java] at com.google.gwt.dev.cfg.ModuleDefLoader$1.load(ModuleDefLoader.java:169)
[java] at com.google.gwt.dev.cfg.ModuleDefLoader.doLoadModule(ModuleDefLoader.java:283)
[java] at com.google.gwt.dev.cfg.ModuleDefLoader.loadFromClassPath(ModuleDefLoader.java:141)
[java] at com.google.gwt.dev.Compiler.run(Compiler.java:184)
[java] at com.google.gwt.dev.Compiler$1.run(Compiler.java:152)
[java] at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:87)
[java] at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:81)
[java] at com.google.gwt.dev.Compiler.main(Compiler.java:159)
[java] [ERROR] Unexpected error while processing XML
[java] com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
[java] at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.parse(ReflectiveParser.java:351)
[java] at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.access$100(ReflectiveParser.java:48)
[java] at com.google.gwt.dev.util.xml.ReflectiveParser.parse(ReflectiveParser.java:398)
[java] at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:257)
[java] at com.google.gwt.dev.cfg.ModuleDefLoader$1.load(ModuleDefLoader.java:169)
[java] at com.google.gwt.dev.cfg.ModuleDefLoader.doLoadModule(ModuleDefLoader.java:283)
[java] at com.google.gwt.dev.cfg.ModuleDefLoader.loadFromClassPath(ModuleDefLoader.java:141)
[java] at com.google.gwt.dev.Compiler.run(Compiler.java:184)
[java] at com.google.gwt.dev.Compiler$1.run(Compiler.java:152)
[java] at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:87)
[java] at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:81)
[java] at com.google.gwt.dev.Compiler.main(Compiler.java:159)
BUILD FAILED
...\build.xml:16: Java returned: 1
Total time: 1 second
build.xml如下所示,取自帖子(create a .war file from gwt-project):
<project name="MyProject" basedir="." default="default">
<property name="src.dir" value="src" />
<property name="build.dir" value="war" />
<property name="lib.dir" value="${build.dir}/WEB-INF/lib" />
<path id="compile.classpath">
<fileset dir="${build.dir}/WEB-INF/lib">
<include name="**/*.jar" />
<include name="**/*.xml" />
</fileset>
</path>
<target name="default" depends="gwtc, buildwar,deploy">
</target>
<target name="gwtc" description="GWT compile to JavaScript">
<java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler">
<classpath>
<pathelement location="${src.dir}" />
<pathelement location="${lib.dir}" />
<path refid="compile.classpath" />
</classpath>
<arg line="-logLevel INFO" />
<jvmarg value="-Xmx1024M" />
<arg value="org.company.prj.MyProject" />
</java>
</target>
<target name="buildwar">
<war basedir="war" destfile="MyProject.war" webxml="war/WEB-INF/web.xml">
<exclude name="WEB-INF/**" />
<webinf dir="war/WEB-INF/">
<include name="**/gwt-servlet.jar" />
<include name="**/classes/**" />
</webinf>
</war>
</target>
<target name="deploy">
<copy file="MyProject.war" todir="." />
</target>
</project>