hosted mode compile error from eclipse

4 views
Skip to first unread message

chris gwt

unread,
Jun 23, 2009, 10:33:27 AM6/23/09
to Google Web Toolkit
Hi everyone, I've run into a little issue when launching hosted mode
with an eclipse run configuration.

I believe the issue is that all of the source directories for my
project are included when compiling for hosted mode.. including unit
test directories that I don't want to include.

My personal style is to put my unit test classes in the same package
as the class being tested, but in a different source directory. The
result of this is that if source/a.b.c.d is included in my gwt
configuration, then test/a.b.c.d seems to be getting compiled as well.

If I understand whats going on, I want a way to exclude particular
source directories from the build.. is that possible?

Chris

Rajeev Dayal

unread,
Jun 24, 2009, 11:04:04 AM6/24/09
to Google-We...@googlegroups.com
Hi Chris,

Right now, we use a heuristic to exclude test directories from your project's classpath on execution. If the folder containing your test source is named "test", then we will not add it to your project's runtime classpath.

We use this heuristic because the plugin currently has no understanding of GWT modules, so it cannot distinguish between test code and source code. In a future version of the plugin, we are going to bake in GWT module information, which will mean that this heuristic will become unnecessary.

If it is not a reasonable solution to name the directory containing your test source code "test", another option is to edit the launch configuration for your application, and remove the test folder from the runtime classpath.


Rajeev

chris

unread,
Jun 24, 2009, 12:25:05 PM6/24/09
to Google Web Toolkit
Thanks for the reply.. I'm not sure what plugin you're referring to,
though.

With regards to removing the test folder from the runtime classpath,
it seems that the only option is to remove the entire project from the
classpath.. I see no option to remove an individual source folder.

--Chris

On Jun 24, 11:04 am, Rajeev Dayal <rda...@google.com> wrote:
> Hi Chris,
> Right now, we use a heuristic to exclude test directories from your
> project's classpath on execution. If the folder containing your test source
> is named "test", then we will not add it to your project's runtime
> classpath.
>
> We use this heuristic because the plugin currently has no understanding of
> GWT modules, so it cannot distinguish between test code and source code. In
> a future version of the plugin, we are going to bake in GWT module
> information, which will mean that this heuristic will become unnecessary.
>
> If it is not a reasonable solution to name the directory containing your
> test source code "test", another option is to edit the launch configuration
> for your application, and remove the test folder from the runtime classpath.
>
> Rajeev
>

Rajeev Dayal

unread,
Jun 24, 2009, 1:20:03 PM6/24/09
to Google-We...@googlegroups.com
Hey Chris,

I think I misunderstood you. I thought that you were using the Google Plugin for Eclipse, but I guess that is not the case. If you're interested in using it, you can find it here: http://code.google.com/eclipse

Do you mind sending a screenshot of the classpath tab for the run configuration that you're using?


Rajeev

chris gwt

unread,
Jun 24, 2009, 1:29:05 PM6/24/09
to Google Web Toolkit
I didn't know about the eclipse plugin, i'll have to check that out
when I have some time.

My classpath tab looks like:

- Bootstrap Entries
L JRE System Library
- User Entries
+ MyProject (default classpath)
L GWT \MyProject\source\
L Other \MyProject\source\
L classes \MyProject\web\WEB-INF\
L gwt-dev-windows.jar \MyProject\tools\GWT\lib\

The class that was giving me the error was in \MyProject\source
\JUnitTests\(...)\a package included in the gwt config file\(...)\

I have since moved it to the default package in \MyProject\source
\JunitTests\ and it has fixed the compile error.. but this seems the
wrong way to fix it, and effects how i would design tests.

On Jun 24, 1:20 pm, Rajeev Dayal <rda...@google.com> wrote:
> Hey Chris,
> I think I misunderstood you. I thought that you were using the Google Plugin
> for Eclipse, but I guess that is not the case. If you're interested in using
> it, you can find it here:http://code.google.com/eclipse
>
> Do you mind sending a screenshot of the classpath tab for the run
> configuration that you're using?
>
> Rajeev
>

Rajeev Dayal

unread,
Jun 24, 2009, 2:10:38 PM6/24/09
to Google-We...@googlegroups.com
In the diagram there, are "GWT", "Other", etc.. are those children of "MyProject (default classpath)"? If so, how did you get "GWT \MyProject\source\" and "Other \MyProject\source\" in the list? Do the entries actually say "\MyProject\source"? Did you add those to your Java build path?

All of that aside, what you should do is create a different source folder for your test code. You can use the same package structure for your test code as you do for your source code (if you'd like). When running your application, make sure that the test code folder is not on the runtime classpath. When running unit tests, make sure that the test code folder IS on the runtime classpath.

chris gwt

unread,
Jun 24, 2009, 4:41:52 PM6/24/09
to Google Web Toolkit


> In the diagram there, are "GWT", "Other", etc.. are those children of
> "MyProject (default classpath)"?
They are children of User Entries. MyProject is also a child of
User Entries and is unexpanded (+)
> If so, how did you get "GWT \MyProject\source\" and "Other \MyProject\source\" in the list?
They were manually added by me.
> Do the entries actually say "\MyProject\source"? Did you add those to your Java build path?
Yes. We the project has several source folders. 6 or 7 "real"
source folders, and 2 unit test folders.
> All of that aside, what you should do is create a different source folder
> for your test code. You can use the same package structure for your test
> code as you do for your source code (if you'd like). When running your
> application, make sure that the test code folder is not on the runtime
> classpath. When running unit tests, make sure that the test code folder IS
> on the runtime classpath.
Thats precisely what I had tried to accomplish originally... The
problem is that all source folders (as defined in the project) are
included in the classpath/source path by default, and are un-
removable, as far as I can tell.

Rajeev Dayal

unread,
Jun 25, 2009, 10:49:39 AM6/25/09
to Google-We...@googlegroups.com
Hey Chris,

Thanks for the information. It should not be the case that all of the source folders defined in the project are included on the classpath by default. It is true that all of the source files in all of your source folders will be compiled and dumped in the same output directory, and these classes will be on your runtime classpath. However, I do not believe that your source folders will ever by added to the runtime classpath for a Java launch configuration by default. Is this what you were seeing? If so, where/how was this shown?


Rajeev
Reply all
Reply to author
Forward
0 new messages