GWT可以配置为在用户的主文件夹以外的其他位置创建缓存文件吗?

4 java gwt caching

我有一个大型项目,我正在使用GWT进行编译.在此过程中,GWT会生成一些缓存文件C:\Documents and Settings\[UserDir]\Local Settings\Temp\.例如:

gwt60627byte-cache (86,321 KB)
gwt60628byte-cache (4,445 KB)
gwt60629byte-cache (53,773 KB)
gwt60696byte-cache (8,111 KB)
gwt60697byte-cache (572,777 KB)
Run Code Online (Sandbox Code Playgroud)

我知道GWT的性能不是那么好,并且没有很多事情要做,加快速度,但是我的项目是在驱动器D:比C:更快,所以我想把这些缓存文件移到同一个驾驶.

但这不是主要原因.我也担心这些文件的大小报告给我留在C上的自由空间:(这并不多).我还没有完成一个完整的项目编译,但是当我这样做时,我不认为硬盘会处理它.

如何在其他位置生成这些缓存文件?

谢谢.

小智 11

The -workDir option in the GWT compiler only controls the location where the "gwt-unitCache-*" files are generated.

To change the location where other GWT temporary files are generated (mainly, the "gwt*byte-cache", "uiBinder*" and "ImageResourceGenerator*.png" files), the only option is to change the value of the "java.io.tmpdir" Java system property through the command line (e.g. "-Djava.io.tmpdir=/path/to/custom/temp/directory".

If using Maven, you can declare this property in the <extraJvmArgs> element of the <configuration> section for the gwt-maven-plugin, within the <plugins> or <pluginManagement> section, likewise:

.../...

<pluginManagement>
    <plugins>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>gwt-maven-plugin</artifactId>
          <version>${gwt.maven.plugin.version}</version>
          <configuration>
            <extraJvmArgs>-Djava.io.tmpdir=${project.build.directory}</extraJvmArgs>
          </configuration>
        </plugin>
    </plugins>
</pluginManagement>

.../...
Run Code Online (Sandbox Code Playgroud)

在此示例中,临时GWT文件将在$ {project.build.directory}中生成,即正在编译的GWT项目的"目标"目录.

<extraJvmArgs>也是您定义GWT编译器使用的任何JVM内存设置的地方,例如"-Xmx1024m".