Hi Bruno,
I think that this package issue with GWT is going to be really annoying,
even if we find workarounds. We will try to automatically rename the
packages of the GWT edition back to "org.restlet.gwt" until a proper
solution is provided by GWT.
Does anyone know if GWT 2.0 better handle this situation where both client
and server sides rely on the same packages?
Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~
http://www.restlet.orgNoelios Technologies ~ Co-founder ~
http://www.noelios.com-----Message d'origine-----
De : news [mailto:
[hidden email]] De la part de Bruno Harbulot
Envoyé : lundi 16 novembre 2009 13:41
À :
[hidden email]
Objet : Re: Restlet GWT callback refactoring
Hi,
I'm trying to upgrade a project from Restlet 1.1 to Restlet 2 (latest
trunk). Most things work, but the GWT side is causing a few problems.
The project is split into a number of Maven modules. I use Eclipse,
M2Eclipse and the Google plugin for Eclipse for GWT development.
To simplify, I have the following projects (using Restlet 1.1):
- artifactId=myApp: the one with the main Restlet Application.
<dependency>
<groupId>org.restlet</groupId>
<artifactId>org.restlet</artifactId>
<version>1.1.5</version>
</dependency>
- artifactId=myServer: the standalone server.
<dependency>
<groupId>myGroup</groupId>
<artifactId>myApp</artifactId>
</dependency>
<dependency>
<groupId>org.restlet</groupId>
<artifactId>org.restlet</artifactId>
<version>1.1.5</version>
</dependency>
<dependency>
<groupId>com.noelios.restlet</groupId>
<artifactId>com.noelios.restlet</artifactId>
<version>1.1.5</version>
</dependency>
<dependency>
<groupId>com.noelios.restlet</groupId>
<artifactId>com.noelios.restlet.ext.jetty</artifactId>
<version>1.1.5</version>
</dependency>
- artifactId=myGwtUi: the GWT user interface.
<dependency>
<groupId>myGroup</groupId>
<artifactId>myApp</artifactId>
</dependency>
<dependency>
<groupId>com.noelios.restlet</groupId>
<artifactId>org.restlet.gwt</artifactId>
<version>1.1.5</version>
</dependency>
<dependency>
<groupId>com.noelios.restlet</groupId>
<artifactId>com.noelios.restlet.ext.gwt</artifactId>
<version>1.1.5</version>
</dependency>
For myGwtUi, the POM file uses *jar* packaging (as I then load the
GWT-generated JavaScript using CLAP from the application when it's
deployed) and uses this:
<build>
<outputDirectory>${basedir}/war/WEB-INF/classes</outputDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>${project.build.directory}/${project.build.finalName}</directory>
<includes>
<include>${gwt.module.alias}/**/*</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>1.1-SNAPSHOT</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>generateAsync</goal>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<runTarget>${gwt.module.alias}/${gwt.module.alias}/</runTarget>
</configuration>
</plugin>
</plugins>
</build>
I also use the Google plugin within Eclipse on the myGwtUi project, and
the WEB-INF/web.xml file contains this:
<servlet>
<servlet-name>gwtShellServletWrapper</servlet-name>
<servlet-class>org.restlet.ext.gwt.GwtShellServletWrapper</servlet-class>
<init-param>
<param-name>org.restlet.application</param-name>
<param-value>myApp</param-value>
</init-param>
...
</servlet>
This works fine with Restlet 1.1, since the GWT client code is in
package org.restlet.gwt and the JSE/JEE client code is in package
org.restlet.
With the current version of Restlet 2.0 and the GWT editions, this
causes some problems.
Although the GWT code shouldn't really depend on the JSE/JEE code, it
does when it's used with the Google plugin. Because this code uses
Restlet as client code, org.restlet.gwt:org.restlet is a dependency, but
because I also want to be able to load myApp from the
GwtShellServletWrapper, org.restlet.jee:org.restlet is also a
dependency. Both editions are on the classpath and clash.
I'm not quite sure how to split this. This might work with different
classloaders, but I don't know how to tell the Google plugin to use a
different jars for the GWT libraries. I'd be happy to specify the jar
files of the GWT edition by hand, but I'm not even sure there's a way to
do this. It looks like the whole point of GWT is to blend in with the
rest of the Java code, and as such, it's a feature to have its required
jars on the project's classpath.
Alternatively, it might be possible to tweak something in the
GwtShellServletWrapper load the Application classes and dependencies
from other jars (but this might in turn make things much more complex
from the Maven point of view).
Any ideas how to solve this?
Best wishes,
Bruno.
Jerome Louvel wrote:
> Hi Jon,
>
> That's a good point; we need to better explain how to use this Restlet
> edition for GWT. I've added a comment on this RFE:
>
http://restlet.tigris.org/issues/show_bug.cgi?id=831>
> Basically, the idea is to launch your Eclipse/GWT project in the "no
server"
> mode. Then you need to create a separate JEE/Servlet project in Eclipse
and
> configure the ServerServlet as usual. If you don't use GWT-RPC in
parallel,
> then you can just run Restlet in the Java SE mode (without a Servlet
> container).
>
> Best regards,
> Jerome Louvel
> --
> Restlet ~ Founder and Lead developer ~
http://www.restlet.org> Noelios Technologies ~ Co-founder ~
http://www.noelios.com------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=7458&dsMessageId=2418479
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=7458&dsMessageId=2419385