我已经使用vaadin启动了一个新的Gradle WebProject。
这是我的build.gradle
apply plugin: 'war'
apply plugin: 'jetty'
apply plugin: 'java'
apply plugin: 'eclipse-wtp'
repositories{
mavenCentral()
}
dependencies{
compile group:'com.vaadin', name:'vaadin-server', version:'7.2.3'
compile group:'com.vaadin', name:'vaadin-client-compiled', version:'7.2.3'
compile group:'javax.servlet', name:'javax.servlet-api', version:'3.1.0'
compile group:'com.google.guava', name:'guava', version:'17.0'
compile group:'org.mindrot', name:'jbcrypt', version:'0.3m'
compile group:'org.reflections', name:'reflections', version:'0.9.9-RC1'
}
工作正常。直到我用" gradle jettyRunWar"它编译并运行但在浏览器中缺少styles.css(HTTP 404)
web.xml的一部分:
<servlet>
<servlet-name>VaadinApplicationServlet</servlet-name>
<servlet-class>com.vaadin.server.VaadinServlet</servlet-class>
<init-param>
<param-name>UI</param-name>
<param-value>ch.boxi.jLogin.ui.NavigatorUI</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>VaadinApplicationServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
我的错误在哪里?
答案 0 :(得分:0)
如果在生产模式下运行vaadin,则必须编译styles.css。要禁用生产模式,您可以修改web.xml:
<context-param>
<description>Vaadin production mode</description>
<param-name>productionMode</param-name>
<param-value>false</param-value>
</context-param>
答案 1 :(得分:0)
根据dependencies
中的build.gradle
部分,您对vaadin-themes
缺失了依赖关系。将以下内容添加到依赖项中:
compile group:'com.vaadin', name:'vaadin-themes', version:'7.2.3'
vaadin-themes
包含Vaadin的内置主题。