Temp gwt directory

33 views
Skip to first unread message

Craig Mitchell

unread,
Sep 25, 2026, 8:44:32 PM (3 days ago) Sep 25
to GWT Users
This bug was doing my head in:  https://github.com/gwtproject/gwt/issues/10329 (because I'm moving widgets in and out of GWT, and when I switch between my git branches, I hit it).

However, I figured out that GWT writes to the windows temp dir %temp%/gwt-cache-xxx/gwt-unitCache and if I delete that, the problem goes away.

I thought it was the tbroyer gwt-maven-plugin creating these temp files, but it wasn't, it's some internal GWT thing.

I managed to relocate the files in the tbroyer plugin configuration with:
<systemProperties>
  <java.io.tmpdir>${project.build.directory}/gwt-temp</java.io.tmpdir>
</systemProperties>

Now a simple mvn clean gets rid of them.  However, GWT won't create this directory automatically, so when you try to run after a clean, you get:

[WARNING] java.lang.ExceptionInInitializerError
[WARNING] at com.google.gwt.dev.javac.CompiledClass.<clinit>(CompiledClass.java:42)
[WARNING] at com.google.gwt.dev.javac.JdtCompiler$CompilerImpl.createCompiledClass(JdtCompiler.java:352)
[WARNING] at com.google.gwt.dev.javac.JdtCompiler$CompilerImpl.process(JdtCompiler.java:315)
[WARNING] at org.eclipse.jdt.internal.compiler.Compiler.processCompiledUnits(Compiler.java:575)
[WARNING] at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:475)
[WARNING] at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:426)
[WARNING] at com.google.gwt.dev.javac.JdtCompiler.doCompile(JdtCompiler.java:1059)
[WARNING] at com.google.gwt.dev.javac.CompilationStateBuilder$CompileMoreLater.compile(CompilationStateBuilder.java:314)
[WARNING] at com.google.gwt.dev.javac.CompilationStateBuilder.doBuildFrom(CompilationStateBuilder.java:519)
[WARNING] at com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:453)
[WARNING] at com.google.gwt.dev.cfg.ModuleDef.getCompilationState(ModuleDef.java:425)
[WARNING] at com.google.gwt.dev.codeserver.Recompiler.initWithoutPrecompile(Recompiler.java:221)
[WARNING] at com.google.gwt.dev.codeserver.Outbox.maybePrecompile(Outbox.java:89)
[WARNING] at com.google.gwt.dev.codeserver.Outbox.<init>(Outbox.java:61)
[WARNING] at com.google.gwt.dev.codeserver.CodeServer.makeOutboxTable(CodeServer.java:194)
[WARNING] at com.google.gwt.dev.codeserver.CodeServer.start(CodeServer.java:153)
[WARNING] at com.google.gwt.dev.codeserver.CodeServer.main(CodeServer.java:106)
[WARNING] at com.google.gwt.dev.codeserver.CodeServer.main(CodeServer.java:57)
[WARNING] Caused by: java.lang.RuntimeException: Unable to initialize byte cache
[WARNING] at com.google.gwt.dev.util.DiskCache.<init>(DiskCache.java:78)
[WARNING] at com.google.gwt.dev.util.DiskCache.<clinit>(DiskCache.java:65)
[WARNING] ... 18 more
[WARNING] Caused by: java.io.IOException: The system cannot find the path specified
[WARNING] at java.base/java.io.WinNTFileSystem.createFileExclusively0(Native Method)
[WARNING] at java.base/java.io.WinNTFileSystem.createFileExclusively(WinNTFileSystem.java:542)
[WARNING] at java.base/java.io.File.createTempFile(File.java:1887)
[WARNING] at java.base/java.io.File.createTempFile(File.java:1928)
[WARNING] at com.google.gwt.dev.util.DiskCache.<init>(DiskCache.java:72)
[WARNING] ... 19 more

This can be fixed by getting maven to create the directory:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-antrun-plugin</artifactId>
  <version>3.2.0</version>

  <executions>
    <execution>
      <id>create-gwt-temp</id>
      <phase>initialize</phase>
      <configuration>
        <target>
          <mkdir dir="${project.build.directory}/gwt-temp"/>
        </target>
      </configuration>
      <goals>
        <goal>run</goal>
      </goals>
    </execution>
  </executions>
</plugin>

I feel like there is a better way to manage the GWT temp directory.  Does anyone have a better solution?  Thanks.

Craig Mitchell

unread,
Sep 25, 2026, 8:59:52 PM (3 days ago) Sep 25
to GWT Users
If I set the tmp directory to just  <java.io.tmpdir>${project.build.directory}</java.io.tmpdir>  then I don't need to get Maven to create it.  The target direcory is spammed with a mass of GWT files, but at least it works.

Thomas Broyer

unread,
Sep 26, 2026, 2:45:52 PM (2 days ago) Sep 26
to GWT Users
You can relocate the persistent unit cache dir with the gwt.persistentunitcachedir system property, so with the maven plugin:
<systemProperties>
  <gwt.persistentunitcachedir>${project.build.directory}/gwt/unitCache/</gwt.persistentunitcachedir>
</systemProperties>

But note that the default location is as a sibling of the output directory for the GWT Compiler (https://github.com/gwtproject/gwt/blob/9940b0200d57ff83ff0a1c43bac4674e5c56b5d1/dev/core/src/com/google/gwt/dev/Compiler.java#L80), and only for the CodeServer is it inside the temporary directory (https://github.com/gwtproject/gwt/blob/main/dev/core/src/com/google/gwt/dev/util/DiskCachingUtil.java).
This might affect how/where you want to configure this, to possibly only change the gwt:codeserver behavior without changing the gwt:compile's one.

…and you can disable the persistent unit cache with gwt.persistentunitcache=false
Reply all
Reply to author
Forward
0 new messages