如何正确使用com.mattbertolini.hermes.Hermes来管理服务器端的常量(GWT)?

时间:2014-03-07 16:46:53

标签: gwt gwtp

好的,我想管理服务器级别的常量,因此com.mattbertolini.hermes.Hermes是一个解决方案。

请查看我的所有步骤:

1-我下载了hermes-1.2.0.jar&导入正确的日食库(没问题)

2-在客户端软件包

创建MyConstantsWithLookup.java
import com.google.gwt.i18n.client.ConstantsWithLookup;

public interface MyConstantsWithLookup extends ConstantsWithLookup {
    String myMsg();
}

3-在同一客户端软件包中创建MyConstantsWithLookup.properties文件。该文件包含以下行:

myMsg=Deleted

4-在Server包中的ServerData.java

MyConstantsWithLookup my = Hermes.get(MyConstantsWithLookup.class, "");
String  extra=my.myMsg();

在eclipse中测试时效果很好,但我在eclipse中得到了Warnign消息:

[WARN] Server class 'com.ibm.icu.util.ULocale' could not be found in the web app, but was found on the system classpath
   [WARN] Adding classpath entry 'file:/C:/Users/eclipse-jee-juno-SR1-win32-x86_64/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.5.0.v201212122042-rel-r42/gwt-2.5.0/gwt-dev.jar' to the web app classpath for this session
   For additional info see: file:/C:/Users/eclipse-jee-juno-SR1-win32-x86_64/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.5.0.v201212122042-rel-r42/gwt-2.5.0/doc/helpInfo/webAppClassPath.html

我不确定这个警告是关于什么的?这是严肃的吗?

代码运行正常但为什么eclipse会生成此警告?

1 个答案:

答案 0 :(得分:1)

此类(com.ibm.icu.util.ULocale)是java.util.Locale的替代品,因此Hermes似乎依赖它。

http://site.icu-project.org/download下载 ICU4J jar ,并将其添加到项目的构建路径中。

来源: Matt Bertolini https://github.com/mattbertolini/Hermes/issues/3

  

您需要添加位于http://site.icu-project.org/的ICU4j jar   到你的类路径。你在里面有ICU课程的原因   gwt-dev.jar是因为GWT将它们包含在Java到JavaScript中   编译器。这是令人遗憾的,因为它经常错误地报道   类路径上的文件。