代码之家  ›  专栏  ›  技术社区  ›  Tum

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

  •  0
  • Tum  · 技术社区  · 11 年前

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

    请查看我的所有步骤:

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

    2-创建 MyConstantsWithLookup.java at客户端包

    import com.google.gwt.i18n.client.ConstantsWithLookup;
    
    public interface MyConstantsWithLookup extends ConstantsWithLookup {
        String myMsg();
    }
    

    3-创建 MyConstantsWithLookup.properties 文件。文件具有以下行:

    myMsg=Deleted
    

    4-在服务器包中的ServerData.java中

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

    当在eclipse中测试时,它工作正常,但我在eclipse中收到警告消息:

    [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 回复  |  直到 11 年前
        1
  •  1
  •   slugmandrew    11 年前

    这个班级( com.ibm.icu.util.ULocale )是的替代品 java.util.Locale ,所以爱马仕似乎对它有依赖。

    下载 ICU4J震击器 从…起 http://site.icu-project.org/download 并将其添加到项目的构建路径中。

    资料来源: 马特·贝托里尼 https://github.com/mattbertolini/Hermes/issues/3

    您需要添加位于的ICU4j jar http://site.icu-project.org/ 到您的类路径。你把ICU课程放在 gwt-dev.jar是因为gwt在Java到JavaScript中包含了它们 编译器。这是令人遗憾的,因为它经常虚报 文件。