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.
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).
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
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.
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors
+1
>> 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.
(though it'd be even better to ditch org.json and use the upcoming
JSON lib; BTW, is it the one from PlayN?)
javax.validation would still be needed as a dependency in your code
> Also, when SuperDevMode becomes the default, we're not going to need
> org.json or javax.validation on the client-side.
(for RequestFactory and/or the Editor framework; and given that
c.g.g.editor.Editor is inherited by c.g.g.user.User, wouldn't you have
warnings from GWT about missing sources even if you don't use it?)
It's not possible to update an artifact that's already been published.
>> 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?
There could be a 2.4.1, identical to 2.4.0 except for the dependencies
declared in the POM; not sure it'd be worth it though, given that
we're finishing up 2.5.
I don't know for the "AppEngine connected Android project" (or
>> 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.
whatever its exact name), but a "standard" GWT project currently is
missing javax.validation (and of course org.json).
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors
I wouldn't be opposed to having differing rules for the GWT SDK
package downloadable at code.google.com and the Maven artifacts.
AFAIK, the original idea of bundling them into gwt-user.jar (and
gwt-dev.jar) was to make things simpler for users (just put gwt-dev
and gwt-user in the classpath).For everyone using artifacts from "The Central Repository" (Maven,
Ivy, Gradle, etc.), bundled dependencies hurt more than they help.
For unfamiliar users, having everything bundled up into a single massive jar does reduce barrier to entry.For anyone with a remotely complex build, being able to pick and choose dependencies can be of vital importance.Aggressive bundling and excessive repackaging can lead to major bloat and potential classpath-order problems,but just adding one jar is the simplest way to get started.So, this suggests that gwt-user could be made a bloated super-jar, with validation and json et al. builtin by jarring in maven.Build this jar from gwt-core, validation, json, elemental, etc. artifacts, but also export these artifacts independently, including a sparse gwt-core.jar.Anyone who doesn't want the bloated omni-jar can take the sparse-jar and declare dependencies manually, then export only what they need to the server,while everyone else can just carry on like normal.
In maven, what's in gwt-user now would become gwt-core, and replace gwt-user with a pom stub that just bundles up the omni gwt-user.jar.gwt-core would be a kernel module representing c.g.g.core.Core + all the .gwt.xml and interfaces / utilities needed to build the gwt environment;the maven build for core could still suck in all the required dependencies to run with packaging pom, and just export a jar/gwtar in release stage.
So, gwt-user.jar and gwt-core.jar would be mutually exclusive {emit warning that classpath is setup inefficiently}.If you take gwt-core, you must also take all other jars you actually need, or deal with classpath manually.If you take gwt-user, don't take any of the other jars; everything is right there.
For IDE / GPE, let it be known that gwt-user is the deprecated way to get up and running quickly,and gwt-core + jars_you_need is the advanced way to get up to max performance.
It may be more work to maintain, and gwt-user.jar updates can only be issued with a stable set of dependencies bundled,but at least the component projects and artifacts can be updated independently in maven central, and then by hand in user classpath;that way, if there is an update to request factory or elemental or widgetFrameworkXYZ, the sub-modules can release updates without waiting on a version release.
For anyone exporting third party libraries, they can just mimic the gwt-user pom to create their own omni-jar, and instruct clients to remove everything but gwt-server/dev.
+1
(though it'd be even better to ditch org.json and use the upcoming
JSON lib; BTW, is it the one from PlayN?)
+1 more. Some example syntax I saw somewhere suggests it's very PlayN like;
>> 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.
For maven, gwt-user 2.4 cannot be changed, but a gwt-core 2.4 can be added with packaging pom, and dependencies declared as needed.For IDE users, a snapshot release with gwt-core and bundled jars, and maybe a pom.xml / generateProject.sh to do mvn eclipse:eclipse to setup classpath?That or just a README with setup instructions / warnings.
> 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.
I don't know for the "AppEngine connected Android project" (or
whatever its exact name), but a "standard" GWT project currently is
missing javax.validation (and of course org.json).
I bring along javax.validation et. al in an eclipse user library, so they're available to dev mode, but never on server classpath.--
http://groups.google.com/group/Google-Web-Toolkit-Contributors
I wouldn't be opposed to having differing rules for the GWT SDK
package downloadable at code.google.com and the Maven artifacts.
AFAIK, the original idea of bundling them into gwt-user.jar (and
gwt-dev.jar) was to make things simpler for users (just put gwt-dev
and gwt-user in the classpath).For everyone using artifacts from "The Central Repository" (Maven,
Ivy, Gradle, etc.), bundled dependencies hurt more than they help.
For unfamiliar users, having everything bundled up into a single massive jar does reduce barrier to entry.For anyone with a remotely complex build, being able to pick and choose dependencies can be of vital importance.Aggressive bundling and excessive repackaging can lead to major bloat and potential classpath-order problems,but just adding one jar is the simplest way to get started.So, this suggests that gwt-user could be made a bloated super-jar, with validation and json et al. builtin by jarring in maven.Build this jar from gwt-core, validation, json, elemental, etc. artifacts, but also export these artifacts independently, including a sparse gwt-core.jar.
Anyone who doesn't want the bloated omni-jar can take the sparse-jar and declare dependencies manually, then export only what they need to the server,while everyone else can just carry on like normal.
In maven, what's in gwt-user now would become gwt-core, and replace gwt-user with a pom stub that just bundles up the omni gwt-user.jar.gwt-core would be a kernel module representing c.g.g.core.Core + all the .gwt.xml and interfaces / utilities needed to build the gwt environment;the maven build for core could still suck in all the required dependencies to run with packaging pom, and just export a jar/gwtar in release stage.
For IDE / GPE, let it be known that gwt-user is the deprecated way to get up and running quickly,and gwt-core + jars_you_need is the advanced way to get up to max performance.
It may be more work to maintain, and gwt-user.jar updates can only be issued with a stable set of dependencies bundled,but at least the component projects and artifacts can be updated independently in maven central, and then by hand in user classpath;that way, if there is an update to request factory or elemental or widgetFrameworkXYZ, the sub-modules can release updates without waiting on a version release.