Closed a14n closed 12 years ago
+1, I had the same issue when I tested modular-requestfactory and guice-rf-activities.
I'd rather add org.json:json
as a dependency than com.google.web.bindery:requestfactory-client
(because requestfactory-client
is already included in gwt-user
, all we need is the transitive dependency on org.json
).
Put differently, gwt-user
's POM should have declared org.json
as an optional dependency; and if it had been the case, we would have had to explicitly declare org.json
as a dependency as we need it.
What do you think?
Using org.json:json
was what I did initially. But, using com.google.web.bindery:requestfactory-client
dependency avoids asking to user the version of org.json:json
to use (as gwt version is configurable on projet generation, org.json:json
should be too).
I agree it would be easyer if gwt-user
's POM had declared org.json:json
as an optional dependency.
AFAICT, if gwt-user
declared org.json
as an optional dependency, you'd have to include the version of org.json
when adding it to your POM. Optional dependencies are hardly more than documentation.
Given that we use the exact same version for requestfactory-client
and gwt-user
and we know they're released from the same sources, we know their classes won't conflict, whichever one comes first in the classpath.
I'm still hesitant to add a dependency on requestfactory-client
though. I'll report the issue to the GWT Team (the GWT SDK doesn't contain org.json
, making it impossible to use RequestFactory out-of-the-box) and see the outcome before fixing it (unless it takes a bit long, in which case we'll fix it here and track the issue to possibly update the workaround, and then wait for a GWT version that really fixes the packaging/dependencies)
You are right on optional dependency ; I thought version could be omitted, but it couldn't.
Otherwise, I agree with what you said.
An alternative solution could be to use an archetype numbering that follows GWT version number (like gwt-maven-plugin
) e.g. net.ltgt.gwt.archetypes:modular-requestfactory:2.4
. Thus for GWT 2.4, we could add directly org.json:json:20090211
to POM. When GWT 2.5 will be out, that dependency could be removed if it is transitively pulled. That said, I'm not a big fan of that solution because of code duplications it involves.
What do you think?
Archetypes are made of Velocity templates so we can probably make the json dependency conditional, depending on the version of GWT being used.
Would you mind updating the pull request with a FIXME comment near the additional dependencies:
<!-- FIXME: used to pull in RF dependencies; should no longer be necessary with GWT 2.5 onwards -->
Also, given that 2.5 will bring so many fixes to RF, I'm inclined to only support 2.5 out-of-the-box when it's released, and add a note in the README about the missing dependency in GWT 2.4.
Done
Thomas Broyer » gwt-maven-archetypes #3 SUCCESS This pull request looks good (what's this?)
When running DevMode with RequestFactory, there is the following error :