Vaadin gradle在styles.css上使用HTTP 404项目

时间:2014-08-06 14:28:31

标签: gradle vaadin vaadin7

我已经使用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>

我的错误在哪里?

2 个答案:

答案 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的内置主题。