aliciagar2
aliciagar2

Reputation: 13

including gwtjsonrpc jar on GWT maven project


I'm trying to optimize the serialization of a GWT Web app.
The app it's maven based and it has 3 modules (project/project-gwt/project-gwt-shared) and one of the methods has to return to client side a large amount of information. This method sends me back a list of large amount of the same DTO, and it consumes a considerable memory and time in the serialization and deserialization.
We made a custom_DTOserializator but although the times is faster, we thinks that it can be improved.

Searching for solutions I found the gwtjsonrpc that it's a implementation of the JSON-RPC 1.1 working for GWT. It's integrated on gerrit so I decided try with it.
I downloaded gwtjsonrpc-1.3.jar and i tried to install it with:

mvn install:install-file -Dfile=gwtjsonrpc-1.3.jar 
    -DgroupId=com.google.gwtjsonrpc -Dpackaging=jar -DartifactId=gwtjsonrpc 
    -Dversion=1.3 -Dclassifier=sources

And I put it in all my poms

<dependency>
    <groupId>com.google.gwtjsonrpc</groupId>
    <artifactId>gwtjsonrpc</artifactId>
    <version>1.3</version>
</dependency>   
<dependency>
    <groupId>com.google.gwtjsonrpc</groupId>
    <artifactId>gwtjsonrpc</artifactId>
    <version>1.3</version>
    <classifier>sources</classifier>
    <type>jar</type>
</dependency>

Following the Readme Instruction I create a new Service, serviceImpl, and ServiceAsyn (AppJsonService)and I'm trying to use it on the old module of my app, putting

<inherits name='com.google.gwtjsonrpc.GWTJSONRPC'/> 
<servlet path='/AppJsonService' class='com.company.project.server.AppJsonServiceImpl'/>

Compiling it with this line (the extra lines id for permgem memory problems)

mvn clean  install:install-file -e -Dfile=gwtjsonrpc-1.3.jar 
-DgroupId=com.google.gwtjsonrpc -Dpackaging=jar -DartifactId=gwtjsonrpc 
-Dversion=1.3  -Dclassifier=sources install -Dmaven.test.skip=true 
-Dgwt.extraJvmArgs="-XX:MaxPermSize=512M -Xmx1024M"

The command install the jar [INFO] Installing C:\Users\me\Desktop\project\version\pom\gwtjsonrpc-1.3.jar to C:\Users\me.m2\repository\com\google\gwtjsonrpc\gwtjsonrpc\1.3\gwtjsonrpc-1.3-sources.jar

but in the compilation of the gwt modules it gives me an error that I don't know how to solve

[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] GWT Module com.google.gwtjsonrpc.GWTJSONRPC not found in project sources or resources.

[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: GWT Module com.google.gwtjsonrpc.GWTJSONRPC not found in project sources or resources.
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
   ...
Caused by: org.apache.maven.plugin.MojoExecutionException: GWT Module com.google.gwtjsonrpc.GWTJSONRPC not found in project sources or resources.
        at org.codehaus.mojo.gwt.shell.CompileMojo.compilationRequired(CompileMojo.java:447)
        at org.codehaus.mojo.gwt.shell.CompileMojo.compile(CompileMojo.java:308)
        at org.codehaus.mojo.gwt.shell.CompileMojo.doExecute(CompileMojo.java:237)
        at org.codehaus.mojo.gwt.shell.AbstractGwtShellMojo.execute(AbstractGwtShellMojo.java:142)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
        ... 17 more
Caused by: org.codehaus.mojo.gwt.utils.GwtModuleReaderException: GWT Module com.google.gwtjsonrpc.GWTJSONRPC not found in project sources or resources
.
        at org.codehaus.mojo.gwt.AbstractGwtModuleMojo.readModule(AbstractGwtModuleMojo.java:205)
        at org.codehaus.mojo.gwt.GwtModule.getLocalInherits(GwtModule.java:189)
        at org.codehaus.mojo.gwt.GwtModule.getInherits(GwtModule.java:149)
        at org.codehaus.mojo.gwt.GwtModule.getEntryPoints(GwtModule.java:114)
        at org.codehaus.mojo.gwt.shell.CompileMojo.compilationRequired(CompileMojo.java:361)
        ... 22 more

Upvotes: 1

Views: 327

Answers (1)

Thomas Broyer
Thomas Broyer

Reputation: 64541

I think your problem is that you're installing a single JAR, instead of 2: one without classifier (gwtjsonrpc-1.3.jar) and one with classifier sources (actually in Maven it's rather type java-source, instead of type jar). You'd use the command:

mvn install:install-file \
   -DgroupId=gwtjsonrpc -Dpackaging=jar -DartifactId=gwtjsonrpc -Dversion=1.3 \
    -Dfile=gwtjsonrpc-1.3.jar -Dsources=gwtjsonrpc-1.3-sources.jar

Oh, and no need to install-file while building your module!

Note that you can find gwtjsonrpc in a Maven repo at http://gerrit-maven.storage.googleapis.com under GAV gwtjsonrpc:gwtjsonrpc:1.3, so just add the <repository> to your POM or proxy it in your repository manager and don't bother installing the JARs manually. And at least you'd have the correct POM with the appropriate dependencies!

Upvotes: 1

Related Questions