Does installing a Module's JAR in Eclipse take 2 steps or 5?

7 views
Skip to first unread message

John Gunther

unread,
Oct 20, 2007, 8:55:19 PM10/20/07
to Google Web Toolkit
>From what I had read, I thought it took 5 steps to install a third-
party module packaged into a JAR into the Eclipse IDE for use in GWT:

1)add <inherits> tag into your project's .gwt.xml file;
2) Add the JAR to the Eclipse build path for your project
3,4,5) Add JAR appropriately to 1 .launch, and 2 .cmd files.

BUT, when just for the heck of it I tried only doing the first two
steps, it worked! Not just in hosted mode, but it also compiled to web
mode, too. No script editing was required.

Am I missing something, or is the two-step approach actually all you
need? I'm using the latest GWT version (1.4.60) so maybe things are
easier now?

John

Ian Petersen

unread,
Oct 21, 2007, 1:15:28 AM10/21/07
to Google-We...@googlegroups.com
On 10/20/07, John Gunther <johncurt...@yahoo.com> wrote:
> 1)add <inherits> tag into your project's .gwt.xml file;
> 2) Add the JAR to the Eclipse build path for your project
> 3,4,5) Add JAR appropriately to 1 .launch, and 2 .cmd files.

If you're talking about what I think you're talking about, the .launch
and .cmd files are just scripts for running the GWT compiler from the
command line. If you let those scripts get out of sync from the
Eclipse environment, it'll make your automated build break. Of
course, if you haven't got an automated build, then it's not a
problem, but everyone should have an automated build....

Ian

--
Tired of pop-ups, security holes, and spyware?
Try Firefox: http://www.getfirefox.com

Isaac Truett

unread,
Oct 22, 2007, 8:23:48 AM10/22/07
to Google-We...@googlegroups.com
1) Required
2) Required if you let Eclipse compile your Java code
3) Required only if you don't do step 2
4&5) Only required if you run the cmds

If you only start your GWT app through Eclipse (using the run/debug
menu or toolbar icons) then the first two steps are all you need. Your
launch file (a physical manifestation of the run/debug configuration)
should be setup to inherit classpath entries from the project (updated
in step 2), so you don't have to explicitly update the launch if your
project is configured properly.

I agree with Ian that you should have an automated build, but I can't
advise using the GWT-generated launch or cmd files as part of it. An
ANT script would be much more flexible.

On 10/20/07, John Gunther <johncurt...@yahoo.com> wrote:
>

John Gunther

unread,
Nov 3, 2007, 6:58:37 PM11/3/07
to Google Web Toolkit
Ian and Isacc

Thanks a lot for your replies--exactly what I needed to know...now I
get it. By the way, I don't have an automated build, but I'm in the
process of following your advice and setting one up, using ant. This
will be my first time using ant. I've found some good general ant info
on line. Are there any good explanation of GWT-specific ant related
stuff your are aware of?

John

On Oct 22, 8:23 am, "Isaac Truett" <itru...@gmail.com> wrote:
> 1) Required
> 2) Required if you let Eclipse compile your Java code
> 3) Required only if you don't do step 2
> 4&5) Only required if you run the cmds
>
> If you only start your GWT app through Eclipse (using the run/debug
> menu or toolbar icons) then the first two steps are all you need. Your
> launch file (a physical manifestation of the run/debug configuration)
> should be setup to inherit classpath entries from the project (updated
> in step 2), so you don't have to explicitly update the launch if your
> project is configured properly.
>
> I agree with Ian that you should have an automated build, but I can't
> advise using the GWT-generated launch or cmd files as part of it. An
> ANT script would be much more flexible.
>

Isaac Truett

unread,
Nov 7, 2007, 7:24:04 AM11/7/07
to Google-We...@googlegroups.com
Using ANT to build your GWT app is pretty straightforward. I use this:

<target name="gwt-compile">
<java classname="com.google.gwt.dev.GWTCompiler"
classpathref="classpath.gwt" fork="true" failonerror="true">
<arg value="-out" />
<arg value="${gwt.out.dir}" />
<arg value="-style" />
<arg value="${gwt.js.style}" />
<arg value="${gwt.module.name}" />
</java>
</target>

And then make a WAR file as usual. Or to run hosted mode:

<target name="gwt-hosted-mode">
<java classname="com.google.gwt.dev.GWTShell"
classpathref="classpath.gwt" fork="true" spawn="true">
<arg value="-out" />
<arg value="${gwt.out.dir}" />
<arg value="${gwt.module.name}/index.html" />
</java>
</target>

I keep those targets in a common location and import into each GWT
project's build.xml. Just set the module name and other variables in a
properties file and off you go.

Reply all
Reply to author
Forward
0 new messages