Eclipse Build Path

GWT Designer allows you to quickly create the modules, composites, panels, remote services and other elements that comprise Google Web Tookit applications.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

Eclipse Build Path

Postby zoemarvin » Thu Aug 16, 2007 11:10 am

I am constructing a GWT module that relies upon some simple serializable classes external to my GWT module project. My module XML file points to the client and external path for the required packages (using source path). I have experimented with the following two scenarios when defining the Eclipse Java Build path:

Scenario 1 - I define the Java Build Path to include the external source and class files for the referenced package using Java Build Path window -> libraries tab-> Add class folder. I select the source folder for my external classes.

Scenario 2 - I define the Java Build Path to include the external source and class files for the referenced package using Java Build Path window ->Projects->add required project. I select the project contaning my external source

Results: both scenarios build properly with no indicated errors, however when I attempt to Run as GWT app in scenario 2, the internal Tomcat browser returns: "HTTP Status 404" - the requested resource is not available.

I am new to Eclipse, but shouldn't scenario 2 be runnable with only this minor classpath configuration difference ?

Thanks for any illumination.
zoemarvin
 
Posts: 1
Joined: Thu Aug 16, 2007 10:50 am

Re: Eclipse Build Path

Postby Eric Clayberg » Thu Aug 16, 2007 12:21 pm

Without a test case, this is mostly guess work, but there are two things that should be done:

1. You should show your external classes to Eclipse to allow it to compile your code (otherwise, you will have compilation errors).

2. You should tell GWT that some packages contain "client side" code, and so should be compiled into JavaScript. You do this using yourModule.gwt.xml.

Remember that all classes that should be accessible from the "client" need to be in some GWT module. Thus, if you want to share some code between two GWT modules, don't use tricks with class path, linked folders, etc. Create a separate GWT module with these classes and include them in your other GWT modules (manually, or just use a class from it and allow GWT Designer's quick fix to import it for you).
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Re: Eclipse Build Path

Postby Eric Clayberg » Fri Aug 17, 2007 4:35 am

BTW, the only "automagic" that we do is to add the "source folders" (in JDT terms, not in GWT) into the classpath, as required by the GWTShell. It is then up to GWT to look in the *.gwt.xml modules and compile the required source packages.

See this ZIP file containing sample projects.

1. gwt-like-project gwt-project - does not work because GWT requires that the "source path" is located in the package of a module:

<source path="path"/>

Adds packages to the source path by combining the package in which the module XML is found with the specified path to a subpackage. Any Java source file appearing in this subpackage or any of its subpackages is assumed to be translatable.

If no <source> element is defined in a module XML file, the client subpackage is implicitly added to the source path as if <source path="client"> had been found in the XML. This default helps keep module XML compact for standard project layouts.

2. project-with-gwt-module gwt-project2 - works because we really have an "external" GWT module and include it.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA


Return to GWT Designer

Who is online

Users browsing this forum: No registered users and 3 guests