我有一个在服务器端使用的 ENUM。
我也希望能够在客户端(GWT)上使用这个枚举。
这是结构:
se.mycompany.core
se.mycompany.core.TheEnum <-- this Enum.
se.mycomapny.web.gwtproject <-- The GWT project.
se.mycomapny.web.gwtproject.client
我尝试添加
<inherits name="se.mycompany.core.TheEnum"/>
到我的 gwtproject.gwt.xml 文件。但我收到以下错误消息:
[错误] 无法在类路径上找到“se/mycompany/core/TheEnum.gwt.xml”;可能是拼写错误,或者您可能忘记包含源的类路径条目?
我尝试使用以下上下文将文件 TheEnum.gwt.xml 添加到“se/mycompany/core/”。
<module>
<inherits name='com.google.gwt.user.User'/>
<source path="TheEnum"></source>
</module>
但它仍然抱怨同样的事情。
我猜我需要以某种方式将 se.mycompany.core.TheEnum 添加到 build.xml 中的类路径中,但我不知道如何或在哪里。
“inherits”标签用于导入其他模块,而不是单个类。您可以通过在下面创建一个简单的 GWT 模块来实现您想要的core
包,然后在现有模块中继承该模块:
创建一个名为Core.gwt.xml
包装下se.mycompany.core
包含以下内容:
<?xml version="1.0" encoding="UTF-8"?>
<module>
<source path="" includes="TheEnum.java"/>
</module>
然后在现有模块中添加:
<inherits name='se.mycompany.core.Core'/>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)