开发者

GWT 2.2 project with CssResource compile problem using ant

In a larger GWT 2.2.0 application we want to use dynamic CellTables. Unlike other widgets, CellTable does not use standard names for css styles (like e.g. "gwt-MenuItem"). So we have to move from standard css to CssResource, which must inlcude the standard "gwt-" styles also, like the following:


public interface IPreferences
{
   public interface MyCssResource extends CssResource
   {
      String content();
      ...
   }

   @ImportedWithPrefix("gwt")
   public interface GwtCss extends CssResource
   {
      String MenuItem();
      String MenuBar();
      String TabLayoutPanelTab();
   }
   ... 

   public interface MyResources extends ClientBundle
   {
      public static final MyResources INSTANCE = GWT.create(MyResources.class);

      @Source("preferences.css")
      @Import(GwtCss.class) <--- any imported interface will produce error
      MyCssResource css开发者_如何转开发Std();
   }
}

This works fine in hosted mode and can be compiled using eclipse, but it does not compile using ant:


   <target name="gwtc" depends="compile" description="GWT compile to JavaScript">
      <java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler">
         <classpath>
            <pathelement location="src"/>
            <pathelement location="gwt-servlet.jar"/>
            <pathelement location="gwt-dev.jar"/>
            <pathelement location="gwt-user.jar"/>
         </classpath>
         <jvmarg value="-Xmx256M"/>
         <arg line="-war"/>
         <arg value="war"/>
         <arg value="...module.file"/>
      </java>
   </target>


   [java] [ERROR] Annotation error: cannot resolve ...IPreferences$GwtCss
   [java] java.lang.ClassNotFoundException: ...IPreferences$GwtCss

I could not find any hint what must be done to compile this outside of eclipse. Thank you for any comment.


You need to generate the resource files in a separate task. The call (as an example from the documentation) to generate it is:

java -cp gwt-dev.jar:gwt-user.jar com.google.gwt.resources.css.InterfaceGenerator \
  -standalone -typeName some.package.MyCssResource -css input.css

So it can be a java task, just like the compiler. It's documented at the gwt CssResource documentation: http://code.google.com/p/google-web-toolkit/wiki/CssResource#Automatically_generating_interfaces

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜