我使用Gradle作为构建管理器设置了一个GWT项目,一切正常。我可以将我的项目部署到eclipse中的本地tomcat中,并且应用程序按照预期运行。但是,如果我启动DevMode并更改CSS资源中的某些内容(这些资源被绑定为带有@Source注释的CssResource类),则GWT DevMode不会捕获它,CSS更改不会得到考虑。我错过了什么吗?我希望DevMode能够在开发过程中检测.css文件中的更改,而无需再次运行gwt编译。
以下是我如何使用CSS资源的示例:
以下是我如何使用CSS资源的示例:
public interface XOFooterPanelResource extends FooterPanelResource, ClientBundle {
@Override
@Source("XOFooterPanel.css")
XOFooterPanelStyle style();
@Override
@ImageOptions(repeatStyle = RepeatStyle.Horizontal)
ImageResource footerPanelBackground();
@Override
@ImageOptions(repeatStyle = RepeatStyle.Horizontal)
ImageResource footerPanelBackgroundEndUser();
@Override
@Source("footerDelimiter.jpg")
ImageResource footerDelimiter();
}
public interface XOFooterPanelStyle extends FooterPanelStyle, CssResource {
}
您可以看到我有一个名为XOFooterPanelStyle的接口,它继承了CssResource。在XOFooterPanelResource中使用@Source注释并加上我的CSS文件名称来使用它(XOFooterPanelResource也是通过继承ClientBundle来使用)。
这里是负责启动DevMode的gradle构建文件的一部分:
javaexec {
main = 'com.google.gwt.dev.DevMode'
jvmArgs = ['-Xmx2048M', '-XX:MaxPermSize=1024M']
classpath {
[
sourceSets.main.java.srcDirs,
// Java source
sourceSets.main.output.resourcesDir,
// Generated resources
sourceSets.main.output.classesDir,
// Generated classes
sourceSets.main.compileClasspath // Deps
]
}
args = [
'-startupUrl',
'myapp/index.html',
'-noserver',
'-war',
'build/devmode',
'-gen',
'gen'
]
ext.gwtModules.each {
args += it
}
}
如前所述,我正在使用 Eclipse 中的 Tomcat 运行应用程序,因此设置了 -noserver
选项。