What GWT calls "production mode" is running the JavaScript generated from
the Java code by the GWT compiler, so the very fact of compiling from Java
to JavaScript gives you "production mode"; there's no such thing as
"compiling in production mode" and "compiling in some other mode" (there's
"draftMode" but it's just one way to tweak the compilation process and its
output, it's still "production mode").
The <productionMode> configuration in the gwt-maven-plugin applies to the
gwt:test goal, not to gwt:compile.
The gwt:compile goal is exactly equivalent to the Ant snippet you gave: it
launches the GWT Compiler to compile the Java code to JavaScript.
Note: the other modes are "dev mode" and "super dev mode": "dev mode" runs
your code in Java (not JS), and "super dev mode" runs your code in
"production mode" but in a way that makes it fast to (re)compile (i.e. not
optimized) and using a resilient compiler, which makes it unsuitable for
production (you don't just compile your code to JS, you also highjack code
into your page with a bookmarklet so that you ask the super dev mode
codeserver to recompile the code before serving it)
I thus don't understand what you mean by “I still see Dev mode code in my
JS files”, what kind of code are you referring to?
On Tuesday, November 19, 2013 3:41:57 AM UTC+1, vikram dave wrote:
>
> Hi,
>
> I am trying to compile my GWT code in production mode using Maven. I set
> production mode true (as seen below) in my pom, but I still see Dev mode
> code in my JS files. I don't want any dev mode code in my production JS
> file. Is there a way to do this using Maven? Can I set some flag/ property
> in my pom or *.gwt.xml file?
>
> <!-- Compile Using GWT -->
>
> <plugin>
>
> <groupId>org.codehaus.mojo</groupId>
>
> <artifactId>gwt-maven-plugin</artifactId>
>
> <version>2.5.1</version>
>
> <executions>
>
> <execution>
>
> <goals>
>
> <goal>compile</goal>
>
> </goals>
>
> <configuration>
>
> <productionMode>true</productionMode>
>
> <classifier>war</classifier>
>
> <warSourceDirectory>src/main/webapp</
> warSourceDirectory>
>
> <webappDirectory>war</webappDirectory>
>
> <module>${Module Name}</module>
>
> <extraJvmArgs>${gwt.extraJvmArgs}</
> extraJvmArgs>
>
> </configuration>
>
> </execution>
>
> </executions>
>
> </plugin>
>
>
> I see that Ant lets you compile in production mode by using following in
> build.xml file. Is there a way I can do this in maven? Or using Ant plugin
> in Maven? (If yes please share an example or point me to a good doc)
>
> <target name="gwtc" depends="javac" description="GWT compile to
> JavaScript (production mode)">
>
> <java failonerror="true" fork="true"
> classname="com.google.gwt.dev.Compiler">
>
> <classpath>
>
> <pathelement location="src"/>
>
> <path refid="project.class.path"/>
>
> <pathelement location="../../validation-api-1.0.0.GA.jar" />
>
> <pathelement location="../../validation-api-1.0.0.GA-sources.jar"
> />
>
> </classpath>
>
> <!-- add jvmarg -Xss16M or similar if you see a StackOverflowError
> -->
>
> <jvmarg value="-Xmx256M"/>
>
> <arg line="-war"/>
>
> <arg value="war"/>
>
> <!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
>
> <arg line="${gwt.args}"/>
>
> <arg value="com.google.gwt.sample.hello.Hello"/>
>
> </java>
>
> </target>
>
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.