Search code examples
mavengwtout-of-memoryvaadin

Maven gwt:compile forks to a different Xmx


Edit: I solved that by taking the plugin out of the "profiles" section and into the general build plugins section even though I don't unerstand how that can work as in my understanding, outside of the profile the plugin is not even defined so it shouldn't even be accessible outside of the correct profile.

I have a Vaadin 6.8 application with Maven that doesn't find its widget set anymore so I want to recompile the widget set which however fails with the following error:

[ERROR] INFORMATION: Searching for paintables.. [INFO] [ERROR] Errors in 'jar:file:/home/username/.m2/repository/com/vaadin/vaadin/6.8.0/vaadin-6.8.0.jar!/com/vaadin/terminal/gwt/client/WidgetSet.java' [INFO] [ERROR] Internal compiler error [INFO] java.lang.OutOfMemoryError: GC overhead limit exceeded [INFO] at org.apache.xerces.dom.DeferredDocumentImpl.getNodeObject(Unknown Source)

After setting `export MAVEN_OPTS="-Xmx12000m" (just to be sure) it forks to a different Xmx (512) and still gets the error (htop snippet):

│  │     ├─ /opt/java/bin/java -Xmx12000m -classpath ...
│  │     ├─ /opt/java/jre/bin/java -Xmx512m -classpath ...

My system: Linux pcname 3.15.2-1-ARCH #1 SMP PREEMPT Fri Jun 27 07:41:19 CEST 2014 x86_64 GNU/Linux, 8 GB RAM

P.S.: I also set localworkers to 1 and fork to false, both of which didn't work.

Edit --- Answer to Thomas: I already use extraJvMArgs. Am I doing something incorrectly there?

    <profile>
        <id>compile-widgetset</id>
        <build>
            <plugins>
                <!-- Compile custom GWT components or widget dependencies with the GWT 
                    compiler -->
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>gwt-maven-plugin</artifactId>
                    <version>${gwt.plugin.version}</version>
                    <configuration>
                        <localWorkers>1</localWorkers>
                        <fork>false</fork>
                        <webappDirectory>src/main/webapp/VAADIN/widgetsets</webappDirectory>
                        <extraJvmArgs>-Xmx2000M -Xss1024k -XX:+UseConcMarkSweepGC</extraJvmArgs>
                        <runTarget>autosparql-tbsl</runTarget>
                        <hostedWebapp>${project.build.directory}/${project.build.finalName}</hostedWebapp>
                        <noServer>true</noServer>
                        <port>9090</port>
                        <compileReport>false</compileReport>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>resources</goal>
                                <goal>compile</goal>
                            </goals>
                        </execution>
                    </executions>
                    <dependencies>
                        <dependency>
                            <groupId>com.google.gwt</groupId>
                            <artifactId>gwt-dev</artifactId>
                            <version>${gwt.version}</version>
                        </dependency>
                        <dependency>
                            <groupId>com.google.gwt</groupId>
                            <artifactId>gwt-user</artifactId>
                            <version>${gwt.version}</version>
                        </dependency>
                    </dependencies>
                </plugin>
                <plugin>
                    <groupId>com.vaadin</groupId>
                    <artifactId>vaadin-maven-plugin</artifactId>
                    <version>1.0.2</version>
                    <executions>
                        <execution>
                            <configuration>
                            </configuration>
                            <goals>
                                <goal>update-widgetset</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>

P.S.: I used "mvn -X gwt:compile" now and it only shows me the default 512M:

[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
[...]
  <extraJvmArgs default-value="-Xmx512m">${gwt.extraJvmArgs}</extraJvmArgs>

Solution

  • The -Xmx for the forked JVM is set in the gwt-maven-plugin configuration: https://gwt-maven-plugin.github.io/gwt-maven-plugin/compile-mojo.html#extraJvmArgs

    extraJvmArgs:

    Extra JVM arguments that are passed to the GWT-Maven generated scripts (for compiler, shell, etc - typically use -Xmx512m here, or -XstartOnFirstThread, etc). Can be set from command line using '-Dgwt.extraJvmArgs=...', defaults to setting max Heap size to be large enough for most GWT use cases.

    • Type: java.lang.String
      • Required: No
      • User Property: gwt.extraJvmArgs
      • Default: -Xmx512m

    The MAVEN_OPTS parameters specified for the Maven execution are not used here.