GWT 编译 POJO
我正在尝试仅使用 Ant 的 GWT 的 Java 到 Javascript 编译器。
我可以在不扩展任何 Google 类(例如 com.google.gwt.core.Core 或类似类)的情况下使用 GWT 编译器吗?如果是这样怎么办?我目前正在 GWT 2.4.0 上使用以下设置。
我正在调用 ant 任务:
build.xml
<target name="gwtc" description="GWT compile to JavaScript (production mode)">
<java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler">
<classpath>
<pathelement location="src"/>
<path refid="project.class.path"/>
<pathelement location="${gwt.sdk}/validation-api-1.0.0.GA.jar" />
<pathelement location="${gwt.sdk}/validation-api-1.0.0.GA-sources.jar" />
</classpath>
<!-- add jvmarg -Xss16M or similar if you see a StackOverflowError -->
<jvmarg value="-Xmx256M"/>
<arg line="-war"/>
<arg value="war"/>
<!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
<arg line="${gwt.args}"/>
<arg value="foo.Test1"/>
</java>
</target>
foo/Test.java
package foo;
public class Test1 {
public String field1;
public String field2;
public int field3;
}
foot/Test1.gwt.xml
<module rename-to="hello">
<source path="foo.Test1"/>
<!--entry-point class="foo.Test1"/-->
</module>
并输出:
gwtc:
[java] Compiling module foo.Test1
[java] [ERROR] Unable to find type 'java.lang.Object'
[java] [ERROR] Hint: Check that your module inherits 'com.google.gwt.core.Core' either directly or indirectly (most often by inheriting module 'com.google.gwt.user.User')
I'm trying to use just the Java to Javascript compiler of the GWT from Ant.
Can I use the GWT compiler without extending any Google classes such as com.google.gwt.core.Core
or similar. If so how? I'm currently using the setup below on GWT 2.4.0.
I'm calling the ant task:
build.xml
<target name="gwtc" description="GWT compile to JavaScript (production mode)">
<java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler">
<classpath>
<pathelement location="src"/>
<path refid="project.class.path"/>
<pathelement location="${gwt.sdk}/validation-api-1.0.0.GA.jar" />
<pathelement location="${gwt.sdk}/validation-api-1.0.0.GA-sources.jar" />
</classpath>
<!-- add jvmarg -Xss16M or similar if you see a StackOverflowError -->
<jvmarg value="-Xmx256M"/>
<arg line="-war"/>
<arg value="war"/>
<!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
<arg line="${gwt.args}"/>
<arg value="foo.Test1"/>
</java>
</target>
foo/Test.java
package foo;
public class Test1 {
public String field1;
public String field2;
public int field3;
}
foot/Test1.gwt.xml
<module rename-to="hello">
<source path="foo.Test1"/>
<!--entry-point class="foo.Test1"/-->
</module>
And output:
gwtc:
[java] Compiling module foo.Test1
[java] [ERROR] Unable to find type 'java.lang.Object'
[java] [ERROR] Hint: Check that your module inherits 'com.google.gwt.core.Core' either directly or indirectly (most often by inheriting module 'com.google.gwt.user.User')
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该错误表明您需要在
gwt.xml
文件中继承'com.google.gwt.core.Core'
,并不是说您的类应该扩展/实施它。尝试一下:或者您不希望您的模块继承它?
The error indicates that you need to inherit
'com.google.gwt.core.Core'
in yourgwt.xml
file and it is not saying that your class should extend/implement it. Give this a try:Or is it that you don't want your module to inherit it?