PersistentUnitCache directory error from parent

177 views
Skip to first unread message

Andrew Green

unread,
Jun 13, 2013, 2:02:43 PM6/13/13
to codehaus-mojo-gwt-...@googlegroups.com
Hi,

I have a GWT project with two Maven modules and a hierarchical directory
layout (as shown in the gwt-maven-plugin documentation). When I build
from the parent directory I get a message saying "Unable to create new
cache log file" and a stack trace. The message appears just before
GwtTests are run.

The build succeeds anyway, so it's really just an annoyance, but I'd
still like to fix it. I can see that the plugin is trying to access a
sub-directory of "target" in the parent folder, however there is no
"target" in that folder.

The message doesn't appear when I build from the child module directory.
So I'm assuming it has something to do with coordinating paths between
parent and child Maven modules.

The full error message is the same as in GWT issue 6443:
http://code.google.com/p/google-web-toolkit/issues/detail?id=6443

As suggested there, I tried setting gwt.persistentunitcache from the
command line. I also tried including, in both the parent pom and the
child pom, the snippet shown there---to no avail.

In case it's relevant: my GwtTests are configured as suggested in the
gwt-maven-plugin documentation > Testing > Use GWTTestSuite padawan. (I
use a GWTTestSuite and test names follow the plugin's default naming
conventions.)

Many thanks in advance for your suggestions, greetings,
Andrew

Thomas Broyer

unread,
Jun 14, 2013, 7:33:39 AM6/14/13
to codehaus-mojo-gwt-...@googlegroups.com
How are you building? (what are your command-line "mvn" arguments?)
Can you show your pom.xml files? 

Andrew Green

unread,
Jun 14, 2013, 2:27:09 PM6/14/13
to codehaus-mojo-gwt-...@googlegroups.com
El 14/06/13 06:33, Thomas Broyer escribió:
From both the parent and the child directories, I'm doing "mvn clean install" (or "mvn -DtestTimeOut=120 clean install").

Here is the parent pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!--
  Copyright 2013 Instituto de Investigaciones Dr. José María Luis Mora
  See LICENSE.txt for redistribution conditions.
 
  D.R. 2013 Instituto de Investigaciones Dr. José María Luis Mora
  Véase LICENSE.txt para los términos bajo los cuales se permite
  la redistribución.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>mx.org.pescadormvp</groupId>
    <artifactId>parent</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>pom</packaging>
    <name>Pescador MVP Parent</name>
    <modules>
        <module>pescadormvp</module>
        <module>examples/jsonp</module>
    </modules>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
</project>

Here is the pom.xml of the child that contains the GwtTests and that actually builds as a GWT app (examples/jsonp.pom.xml):

<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2013 Instituto de Investigaciones Dr. José María Luis Mora
    See LICENSE.txt for redistribution conditions. D.R. 2013 Instituto de Investigaciones
    Dr. José María Luis Mora Véase LICENSE.txt para los términos bajo los cuales
    se permite la redistribución. -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>mx.org.pescadormvp</groupId>
    <artifactId>jsonp-example</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>Pescador MVP JSONP Example</name>
    <properties>
        <gwtVersion>2.5.1</gwtVersion>
        <webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.6</maven.compiler.source>
        <maven.compiler.target>1.6</maven.compiler.target>
        <gwt.test.mode>htmlunit</gwt.test.mode>
    </properties>
    <dependencies>
        <!-- Base GWT and related dependencies -->
        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-servlet</artifactId>
            <version>${gwtVersion}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-user</artifactId>
            <version>${gwtVersion}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.7</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>1.0.0.GA</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>1.0.0.GA</version>
            <classifier>sources</classifier>
            <scope>test</scope>
        </dependency>
        <!-- Pescador MVP (in other Maven module) -->
        <dependency>
            <groupId>mx.org.pescadormvp</groupId>
            <artifactId>pescadormvp</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>
        <!-- OpenLayers for embedded map -->
        <dependency>
            <groupId>org.gwtopenmaps.openlayers</groupId>
            <artifactId>gwt-openlayers-client</artifactId>
            <version>0.8</version>
        </dependency>
        <!-- Jukito and Hamcrest for testing -->
        <dependency>
            <groupId>org.jukito</groupId>
            <artifactId>jukito</artifactId>
            <version>1.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-library</artifactId>
            <version>1.3</version>
            <scope>test</scope>
        </dependency>
       
    </dependencies>
    <build>
        <!-- Generate compiled stuff in the folder used for dev mode -->
        <outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
        <plugins>
            <!-- GWT Maven Plugin: default setup, except for messages -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>gwt-maven-plugin</artifactId>
                <version>2.5.1</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                            <goal>test</goal>
                            <goal>i18n</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <runTarget>jsonp-example.html</runTarget>
                    <hostedWebapp>${webappDirectory}</hostedWebapp>
                    <!-- Classes for messages are generated as specified here -->
                    <i18nMessagesBundles>
<i18nMessagesBundle>mx.org.pescadormvp.jsonpexample.client.query.QueryMessages</i18nMessagesBundle>

                    </i18nMessagesBundles>
                </configuration>
            </plugin>
            <!-- Copy static web files before executing gwt:run -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.1.1</version>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>exploded</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <webappDirectory>${webappDirectory}</webappDirectory>
                </configuration>
            </plugin>
            <!-- Compiler plugin -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>${maven.compiler.source}</source>
                    <target>${maven.compiler.target}</target>
                </configuration>
            </plugin>
            <!-- Site plugin for easy viewing of test reports -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <version>3.3</version>
                <configuration>
                    <reportPlugins>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-project-info-reports-plugin</artifactId>
                            <version>2.4</version>
                            <configuration>
                                <dependencyDetailsEnabled>false</dependencyDetailsEnabled>
                                <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
                            </configuration>
                            <reports>
                                <report>dependencies</report>
                            </reports>
                        </plugin>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-javadoc-plugin</artifactId>
                            <version>2.8</version>
                        </plugin>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-surefire-report-plugin</artifactId>
                            <version>2.8</version>
                        </plugin>
                    </reportPlugins>
                </configuration>
            </plugin>
            <!-- I tried this to avoid the error. Didn't work. -->
            <!-- See http://code.google.com/p/google-web-toolkit/issues/detail?id=6443 -->
<!--             <plugin> -->
<!--                 <artifactId>maven-surefire-plugin</artifactId> -->
<!--                 <configuration> -->
<!--                     <systemProperties> -->
<!--                         <property> -->
<!--                             <name>gwt.args</name> -->
<!--                             <value>-out target/gwt-test</value> -->
<!--                         </property> -->
<!--                         <property> -->
<!--                             <name>gwt.persistentunitcache</name> -->
<!--                             <value>true</value> -->
<!--                         </property> -->
<!--                     </systemProperties> -->
<!--                 </configuration> -->
<!--             </plugin> -->
        </plugins>
       
        <pluginManagement>
            <plugins>
                <!-- This configuration provides Eclipse m2e settings
                     only. It has no influence on the Maven build itself. -->
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>
                                            org.apache.maven.plugins
                                        </groupId>
                                        <artifactId>
                                            maven-war-plugin
                                        </artifactId>
                                        <versionRange>
                                            [2.1.1,)
                                        </versionRange>
                                        <goals>
                                            <goal>exploded</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore></ignore>
                                    </action>
                                </pluginExecution>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.codehaus.mojo</groupId>
                                        <artifactId>
                                            gwt-maven-plugin
                                        </artifactId>
                                        <versionRange>
                                            [2.4.0,)
                                        </versionRange>
                                        <goals>
                                            <goal>i18n</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore></ignore>
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project>

Finally, here is the pom.xml of the other module (pescadormvp/pom.xml) (contains code used in the GWT app but does not itself compile as a GWT app):

<?xml version="1.0" encoding="UTF-8"?>
<!--
  Copyright 2013 Instituto de Investigaciones Dr. José María Luis Mora
  See LICENSE.txt for redistribution conditions.
 
  D.R. 2013 Instituto de Investigaciones Dr. José María Luis Mora
  Véase LICENSE.txt para los términos bajo los cuales se permite
  la redistribución.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <!-- POM file for Pescador MVP framework -->
    <modelVersion>4.0.0</modelVersion>
    <groupId>mx.org.pescadormvp</groupId>
    <artifactId>pescadormvp</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>
    <name>Pescador MVP</name>
    <properties>
        <gwtVersion>2.5.1</gwtVersion>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.6</maven.compiler.source>
        <maven.compiler.target>1.6</maven.compiler.target>
    </properties>
    <dependencies>
        <!-- Base GWT and related dependencies -->
        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-servlet</artifactId>
            <version>${gwtVersion}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-user</artifactId>
            <version>${gwtVersion}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.7</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>1.0.0.GA</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>1.0.0.GA</version>
            <classifier>sources</classifier>
            <scope>test</scope>
        </dependency>
        <!-- GIN (GWT dependency injection) -->
        <dependency>
            <groupId>com.google.gwt.inject</groupId>
            <artifactId>gin</artifactId>
            <version>2.0.0</version>
        </dependency>
        <!-- GWT dispatch -->
        <dependency>
            <groupId>net.customware.gwt.dispatch</groupId>
            <artifactId>gwt-dispatch</artifactId>
            <version>1.1.0</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>
    </dependencies>
    <build>
        <!-- Generate compiled stuff in the folder used for dev mode -->
        <outputDirectory>target/classes</outputDirectory>
        <plugins>
            <!-- GWT Maven Plugin: just used to copy sources into jar -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>gwt-maven-plugin</artifactId>
                <version>2.5.1</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>resources</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- Compiler plugin -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>${maven.compiler.source}</source>
                    <target>${maven.compiler.target}</target>
                </configuration>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
           
                <!-- This helps Eclipse coordinate with Maven  -->
                <!-- Has no effect on Maven execution itself -->
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.codehaus.mojo</groupId>
                                        <artifactId>gwt-maven-plugin</artifactId>
                                        <versionRange>[2.4.0,)</versionRange>
                                        <goals>
                                            <goal>resources</goal>
                                            <goal>compile</goal>
                                            <goal>i18n</goal>
                                            <goal>generateAsync</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <execute />
                                    </action>
                                </pluginExecution>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.apache.maven.plugins</groupId>
                                        <artifactId>maven-war-plugin</artifactId>
                                        <versionRange>[2.1.1,)</versionRange>
                                        <goals>
                                            <goal>exploded</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <execute />
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project>

Here is the relevant Maven output when I run "mvn -DtestTimeOut=120 clean install" from the parent module directory.

[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running tests that require GWT browser context
[INFO] [WARN] Unable to create new cache log file /home/myhomedir/programming/github/target/www-test/../gwt-unitCache/gwt-unitCache-0000013F434CA249.
[INFO] java.io.IOException: No such file or directory
[INFO]     at java.io.UnixFileSystem.createFileExclusively(Native Method)
[INFO]     at java.io.File.createNewFile(File.java:947)
[INFO]     at com.google.gwt.dev.javac.PersistentUnitCache.createCacheFile(PersistentUnitCache.java:120)
[INFO]     at com.google.gwt.dev.javac.PersistentUnitCache.<init>(PersistentUnitCache.java:264)
[INFO]     at com.google.gwt.dev.javac.UnitCacheFactory.get(UnitCacheFactory.java:59)
[INFO]     at com.google.gwt.dev.javac.CompilationStateBuilder.init(CompilationStateBuilder.java:403)
[INFO]     at com.google.gwt.dev.DevModeBase.doStartup(DevModeBase.java:917)
[INFO]     at com.google.gwt.dev.DevMode.doStartup(DevMode.java:424)
[INFO]     at com.google.gwt.junit.JUnitShell.doStartup(JUnitShell.java:931)
[INFO]     at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1083)
[INFO]     at com.google.gwt.junit.JUnitShell.getUnitTestShell(JUnitShell.java:707)
[INFO]     at com.google.gwt.junit.JUnitShell.runTest(JUnitShell.java:652)
[INFO]     at com.google.gwt.junit.client.GWTTestCase.runTest(GWTTestCase.java:441)
[INFO]     at junit.framework.TestCase.runBare(TestCase.java:134)
[INFO]     at junit.framework.TestResult$1.protect(TestResult.java:110)
[INFO]     at junit.framework.TestResult.runProtected(TestResult.java:128)
[INFO]     at junit.framework.TestResult.run(TestResult.java:113)
[INFO]     at junit.framework.TestCase.run(TestCase.java:124)
[INFO]     at com.google.gwt.junit.client.GWTTestCase.run(GWTTestCase.java:296)
[INFO]     at junit.framework.TestSuite.runTest(TestSuite.java:232)
[INFO]     at junit.framework.TestSuite.run(TestSuite.java:227)
[INFO]     at junit.framework.TestSuite.runTest(TestSuite.java:232)
[INFO]     at junit.framework.TestSuite.run(TestSuite.java:227)
[INFO]     at junit.framework.TestSuite.runTest(TestSuite.java:232)
[INFO]     at junit.framework.TestSuite.run(TestSuite.java:227)
[INFO]     at org.codehaus.mojo.gwt.test.MavenTestRunner.doRun(MavenTestRunner.java:105)
[INFO]     at junit.textui.TestRunner.start(TestRunner.java:180)
[INFO]     at org.codehaus.mojo.gwt.test.MavenTestRunner.main(MavenTestRunner.java:63)
[INFO] logging for HtmlUnit thread
[INFO]    [WARN] Obsolete content type encountered: 'application/x-javascript'.
[INFO]    [WARN] Obsolete content type encountered: 'application/x-javascript'.
[INFO] Tests run: 11, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 48.799 sec

The code for the whole project can be gotten from Github like so:
git clone https://github.com/AndrewGreen/pescadormvp.git

(I'm just finishing up the documentation... Soon I'll announcement the project on the general GWT list.)

Thanks a ton for your help! Greetings,
Andrew

Thomas Broyer

unread,
Jun 16, 2013, 5:34:27 PM6/16/13
to codehaus-mojo-gwt-...@googlegroups.com
OK got it; that's a bug.
When outFile is not absolute (which is the case by default), it should be redefined as new File(getProject().getBaseDir(), out).

A workaround should be to explicitly set 'out' to absolute path, such as ${project.build.directory}/www-test. This is what I just did on master: https://github.com/gwt-maven-plugin/gwt-maven-plugin/commit/2fa0f0065aecde5e6ced88eb5f82a6e914ec2cdb

Andrew Green

unread,
Jun 16, 2013, 10:36:12 PM6/16/13
to codehaus-mojo-gwt-...@googlegroups.com
Fantastic to see this tracked down so quickly. I can confirm that the version of the plugin in 2fa0f0065aecde5e6ced88eb5f82a6e914ec2cdb does not produce the error when "out" is left at its default. I can also confirm that setting "out" to an absolute path removes the error with the current version of the plugin (2.5.1). Thank you again for your help. Please let me know if there's anything I can also do (maybe test additional fixes?). Following is the working configuration from the pom of the child module that builds as a GWT app (example/jsonp/pom.xml).
<plugin>
	<groupId>org.codehaus.mojo</groupId>
	<artifactId>gwt-maven-plugin</artifactId>
	<version>2.5.1</version>
	<executions>
		<execution>
			<goals>
				<goal>compile</goal>
				<goal>test</goal>
				<goal>i18n</goal>
			</goals>
		</execution>
	</executions>
	<configuration>
		<runTarget>jsonp-example.html</runTarget>
		<hostedWebapp>${webappDirectory}</hostedWebapp>
		<i18nMessagesBundles>
			<i18nMessagesBundle>mx.org.pescadormvp.jsonpexample.client.query.QueryMessages</i18nMessagesBundle>
		</i18nMessagesBundles>
		<out>${project.build.directory}/www-test</out> <!-- This line fixed it -->
	</configuration>
</plugin>
Greetings,
Andrew

El 16/06/13 16:34, Thomas Broyer escribió:
Reply all
Reply to author
Forward
0 new messages