what gwt libraries should be included in production build

412 views
Skip to first unread message

zixzigma

unread,
Feb 27, 2011, 1:54:13 PM2/27/11
to google-we...@googlegroups.com
do I need gwt-servlet and gwt-user library, in my pom.xml ?
I was uploading my gwt app on app engine, I got the error
saying gwt-user jar is too big, and I need to split it.
I decided to comment out gwt-user, and I didn't get any error or warning,
which made me wonder what dependencies I need to include in my build ?
and is there a library that need to be present in development mode, that should be excluded in final build ?

Thank You

        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-servlet</artifactId>
            <version>${gwt.version}</version>
        </dependency>

        <!--<dependency>-->
            <!--<groupId>com.google.gwt</groupId>-->
            <!--<artifactId>gwt-user</artifactId>-->
            <!--<version>${gwt.version}</version>-->
            <!--<scope>provided</scope>-->
        <!--</dependency>-->

Thomas Broyer

unread,
Feb 28, 2011, 6:45:28 AM2/28/11
to google-we...@googlegroups.com

On Sunday, February 27, 2011 7:54:13 PM UTC+1, zixzigma wrote:
do I need gwt-servlet and gwt-user library, in my pom.xml ?

It depends what you do with your pom.xml, i.e. how you use the dependencies.
 
I was uploading my gwt app on app engine, I got the error
saying gwt-user jar is too big, and I need to split it.
I decided to comment out gwt-user, and I didn't get any error or warning,
which made me wonder what dependencies I need to include in my build ?

 
and is there a library that need to be present in development mode, that should be excluded in final build ?

DevMode and Compiler classes are in gwt-dev.jar, and all the code you use to build your app is in gwt-user.jar. Almost everything in gwt-user.jar is aimed at being compiled to JavaScript, the rest is present in gwt-servlet (making gwt-servlet a subset of gwt-user; well, there might be a few classes from gwt-dev too that are also copied to gwt-servlet, but that's an implementation detail).
In brief, you need gwt-dev and gwt-user to build your client-side code, and you need gwt-servlet (and only gwt-servlet) on the server-side (and only if you use GWT-RPC and/or RequestFactory).

This means that if your mix client-side and server-side code in your Maven module, you need to have gwt-user as <scope>provided</scope> (it's indeed provided by the gwt-maven-plugin) and gwt-servlet as <scope>runtime</scope> (gwt-dev is provided by the gwt-maven-plugin, so you don't need an explicit dependency, unless you have to write a generator or linker, but then beware of conflicts with some libraries; you'd better split your app into a client-side only and server-side modules)
Reply all
Reply to author
Forward
0 new messages