Hey Thomas,

Thanks for pointing this out. This is pretty whacked, and is probably a
symptom of a problem that we've had for a long time - how do we handle
dependencies on GWT? Should we bundle them, re-package them, or require the
user to add them to the classpath?

Other replies inline:

On Tue, May 29, 2012 at 4:51 AM, Thomas Broyer <[email protected]> wrote:

> Hi all,
>
> it looks like there's an issue in packaging the GWT SDK (and GWT maven
> artifacts): org.json is not bundled gwt-user. That makes it harder to use
> RequestFactory out-of-the-box, as DevMode will have NoClassDefFoundErrors
> when trying to *send* a request to the server. org.json is bundled into
> requestfactory-server.jar and gwt-servlet-deps.jar, which makes it usable
> out-of-the-box on the server-side; it's also bundle into
> requestfactory-client.jar so you can easily run VM client-side code too (in
> unit-tests, an Android app, etc.) To run RF code in DevMode, you'd have to
> add the org.json JAR (downloaded somewhere on the internet) or the
> requestfactory-client.jar (which duplicates a lot of classes from
> gwt-user.jar), or the gwt-servlet-deps.jar (which is supposedly related to
> server-side code only) to your classpath; this is not intuitive.
>

Is this a new problem? It seems that this would have always been present.
Was a recent change made to expose this?

All those options that you mention are less-than-ideal. My preference would
be to have them download org.json from the Internet, but it rubs me the
wrong way that it won't work out of the box.


>
> What's striking is that javax.validation is *not* bundled that way
> (except, as expected, in gwt-servlet-deps.jar), it's instead shipped as a
> separate JAR in the SDK; it's not even bundled into gwt-user.jar.
>
> There's a real discrepancy between org.json and javax.validation wrt
> packaging in the SDK, and none of them is satisfactory.
>
>
>    - requestfactory-* JARs contain org.json but not javax.validation
>    - gwt-user contains none of them
>    - gwt-servlet-deps is made of only org.json and javax.validation, so
>    why ship javax.validation in addition to it?
>
> IMO, both dependencies should receive equal treatment: either ship as
> separate JARs in the SDK (json.jar and validation-api.jar), or be bundled
> where needed (if you ask me, only in gwt-user.jar –similar to what's done
> with javax.servlet– and gwt-servlet-deps.jar; possibly renamed to or
> duplicated as requestfactory-deps.jar, as they are dependencies for both
> requestfactory-client and requestfactory-server).
>

I'd lean towards to having json.jar and validation-api.jar - even though it
makes it harder to work with out-of-the-box, we're trying to move in the
direction of breaking GWT into smaller components.

Also, when SuperDevMode becomes the default, we're not going to need
org.json or javax.validation on the client-side.


> Now, we have similar issues with Maven artifacts: gwt-user.jar depends on
> javax.validation but not org.json, so the DevMode will fail (whether you
> launch it with "Run As… Web Application" in Eclipse or "mvn gwt:run")
> unless you add a dependency on org.json. org.json is not even
> referenced/documented as an optional dependency (but given that
> javax.validation is not marked as "optional", there's no reason org.json
> would be marked "optional").
> We're currently facing this issue in gwt-maven-archetypes and I'm not sure
> what we should do: add a dependency on requestfactory-client (contains
> duplicate classes from gwt-user) or on org.json (weird as we don't directly
> use org.json classes, and org.json is not marked as an optional dependency
> of gwt-user). https://github.com/tbroyer/gwt-maven-archetypes/pull/16
>

Maybe we need to mark org.json as a required dep of gwt-user? Is this
possible?


>
> I'll try to submit a patch to have it fixed in 2.5 but we must first
> settle on the appropriate way to do it (both for the GWT SDK and for Maven
> artifacts), and I'd also like your feedback on what would be the
> appropriate workaround while waiting for 2.5.
>
>
Whatever we do, we're going to have to make sure that we update GPE so that
it knows to add the appropriate dependent jars to the classpath.


> --
> http://groups.google.com/group/Google-Web-Toolkit-Contributors

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to