Hi Gal, thank you for sharing the gwt ant build script.
The script wasn't the problem, I was able to compile the source with
the default ant build script. The problem was that compiled code from
Eclipse worked but from command line didn't.
Today I made some other tests and I finally I identified the problem.
I compiled the source code in Eclipse using DETAILED, PRETTY and
OBFUSCATED output. And I did the same with the ant script. Then I
compared them.
I was hoping to see some differences in Eclipse generated code and in
command line, but to my surprise all generated files were binary
identical! => it was not problem of compiling.
Then I deployed to the test environment each version. OBFUSCATED
version failed with error. But, when I deployed PRETTY and DETAILED
versions the code worked!
So it also explains, why I wasn't getting errors from Eclipse build,
because output might have been set to PRETTY / DETAILED. Ant script by
default produces obfuscated code.
Here is a code snippet from the native method, that fails:
public static native String parseJSON(String json) /*-{
var retval = [];
try {
var x = 0;
if (json != null) {
var obj = eval( '(' + json + ')' ); <---- HERE IT
FAILS
var entries = obj.feed.entry;
I was getting error 'Can't find variable obj'.
I've replaced the eval function with JSON.parse method (http://
www.json.org/js.html) and included json2.js file in the entry html
file, but it is still the same. Obfuscated version doesn't work and
I'm getting the same error 'Can't find variable obj' while detailed
version works.
Any ideas?
On Nov 17, 4:08 am, Gal Dolber <[email protected]> wrote:
> I'm compiling projects using gwt trunk from ant without problem
>
> this is my base ant scripthttp://pastebin.com/prRQEETz
>
> and this is how I extend it for each projecthttp://pastebin.com/t7RLmd29
>
> the script asume you are using lombok and it support annotation processors,
> but you should be able to extract the gwt compilation part.
>
> Hope it helps
>
>
>
>
>
>
>
>
>
> On Wed, Nov 16, 2011 at 4:48 PM, jogo <[email protected]> wrote:
> > Hi,
>
> > I'm getting really frustrated from this, so any advice is highly
> > appreciated.
>
> > In my GWT project, there is a java native method that calls eval
> > function inside. All worked fine till I updated from 2.3.0 to 2.4.0
> > (on Windows XP in Eclipse). After that, when I compiled the project in
> > Eclipse (GWT 2.4.0) the native method stopped working and I spent
> > quite a lot of time figuring out what was the cause of this problem.
>
> > It turned out, that the update form 2.3.0 to 2.4.0 caused it. Then I
> > downgraded back to GWT SDK 2.3.0, re-configured Eclipse and then again
> > all worked fine.
>
> > Today I created a simple ant build script (generated from
> > webAppCreator app using SDK 2.3.0) and used it. And again, the problem
> > re-surfaced, the native method doesn't work! The ant script uses SDK
> > 2.3.0.
>
> > The surprising thing is, that when I compile the project from Eclipse
> > with SDK 2.3.0 all works fine. When I compile the project from command
> > line using the same SDK and JRE compiled code is different and doesn't
> > work.
>
> > Any idea where the problem might be? Thanks.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google Web Toolkit" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected].
> > For more options, visit this group at
> >http://groups.google.com/group/google-web-toolkit?hl=en.
>
> --
> Guit: Elegant, beautiful, modular and *production ready* gwt applications.
>
> http://code.google.com/p/guit/
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.