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.