GWT 不编译项目 nocache.js 警告

时间:2020-12-29 04:16:17

标签: java intellij-idea caching gwt compilation

我在 GWT 2.9.0 上运行我的应用

我完成了所有很好的 util 重建项目。

从今天起,我的 GWT 项目不再工作!

我从 Intellij Ultimate 运行它们

HTML 打开,但程序无法编译。

我收到这条消息:

    Dev Mode initialized. Startup URL: 
http://127.0.0.1:8888/One_armed_bandit.html
[WARN] 404 - GET /one_armed_bandit/one_armed_bandit.nocache.js (127.0.0.1) 328 bytes
   Request headers
      Host: 127.0.0.1:8888
      Connection: keep-alive
      User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36
      DNT: 1
      Accept: */*
      Sec-Fetch-Site: same-origin
      Sec-Fetch-Mode: no-cors
      Sec-Fetch-Dest: script
      Referer: http://127.0.0.1:8888/One_armed_bandit.html
      Accept-Encoding: gzip, deflate, br
      Accept-Language: pl-PL,pl;q=0.9,en-US;q=0.8,en;q=0.7
   Response headers
      Date: Tue, 29 Dec 2020 04:07:15 GMT
      Content-Type: text/html; charset=ISO-8859-1
      Cache-Control: must-revalidate,no-cache,no-store
      Content-Length: 328

现在我不知道该怎么办。 我是 GWT 的新手。第一次接触时非常坚固的工具。

这是一些代码: 我的 pom.xml:

<?xml version="1.0" encoding="UTF-8"?>

4.0.0

<groupId>groupId</groupId>
<artifactId>one-armed-bandit</artifactId>
<version>1.0-SNAPSHOT</version>

<build>
    <plugins>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>8</source>
                <target>8</target>
            </configuration>
        </plugin>
    </plugins>
</build>

<dependencies>
    <!-- https://mvnrepository.com/artifact/com.google.gwt/gwt-servlet -->
    <dependency>
        <groupId>com.google.gwt</groupId>
        <artifactId>gwt-servlet</artifactId>
        <version>2.9.0</version>
        <scope>runtime</scope>
    </dependency>

    <!-- https://mvnrepository.com/artifact/com.google.gwt/gwt-user -->
    <dependency>
        <groupId>com.google.gwt</groupId>
        <artifactId>gwt-user</artifactId>
        <version>2.9.0</version>
        <scope>provided</scope>
    </dependency>

    <!-- https://mvnrepository.com/artifact/com.google.gwt/gwt-dev -->
    <dependency>
        <groupId>com.google.gwt</groupId>
        <artifactId>gwt-dev</artifactId>
        <version>2.9.0</version>
        <scope>provided</scope>
    </dependency>


</dependencies>

web.xml

    <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
              http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         version="2.5"
         xmlns="http://java.sun.com/xml/ns/javaee">

  <!-- Servlets -->
  <servlet>
    <servlet-name>greetServlet</servlet-name>
    <servlet-class>eu.mrndesign.matned.server.GreetingServiceImpl</servlet-class>
  </servlet>
  
  <servlet-mapping>
    <servlet-name>greetServlet</servlet-name>
    <url-pattern>/one_armed_bandit/greet</url-pattern>
  </servlet-mapping>
  
  <!-- Default page to serve -->
  <welcome-file-list>
    <welcome-file>One_armed_bandit.html</welcome-file>
  </welcome-file-list>

</web-app>

one_armed_bandit.xml

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.9.0//EN"
  "http://gwtproject.org/doctype/2.9.0/gwt-module.dtd">
<module rename-to='one_armed_bandit'>
  <inherits name='com.google.gwt.user.User'/>

                         -->
  <inherits name='com.google.gwt.user.theme.clean.Clean'/>
                      -->
  <entry-point class='eu.mrndesign.matned.client.One_armed_bandit'/>

  <source path='client'/>
  <source path='shared'/>

  <add-linker name="xsiframe"/>
</module>

我还没有在 sackoverflow 上找到任何解决我的问题的方法。

GWT module options

Web module opions

1 个答案:

答案 0 :(得分:0)

检查文件中的 GWT facet 是否正确配置 |项目结构 |模块 | | GWT 和Target Web Facet 已设置。

enter image description here

Web facet 还应该设置 Web Resources DirectorySource Roots

{{3}}