24

Sometimes, when I start Eclipse (Java EE IDE for Web Developers, Indigo SR 1) on my MacOSX Lion, my GWT (2.4.0) project initially fails to compile.

Eclipse displays the following message in the "Problems" section:

The project XXX does not have any GWT SDKs on its build path

Here is a list of semi-solutions that sometimes work (I normally try them in this order):

  1. Project > Clean.
  2. Remove and re-add GWT SDK to the build path.
  3. Restart the machine.

Any help with preventing the problem from re-occurring would be most welcome.

Rok Strniša
  • 6,781
  • 6
  • 41
  • 53

7 Answers7

28

I encountered the same problems as described above. But none of the solutions worked.

What did work was moving the GWT SDK above the other GWT dependencies in the build path. See the following blog (written by my personal hero of the day): Grant Little's Blog

Hugo
  • 10,546
  • 2
  • 17
  • 9
13

I believe the problem was occurring because Eclipse had some stale settings about available/linked GWTs.

Therefore, building on the answer by Chris Cashwell, I recommend the following:

  1. Remove all GWTs from your build path. (You might have more than one GWT on your build path.)
  2. Remove all GWTs linked in Eclipse in Project>Properties>Google>Web Toolkit>Configure SDKs, .
  3. Add only the latest GWT, and make it default.

EDIT: Sometimes, I still need to do a Project > Clean, but this is rare now.

Community
  • 1
  • 1
Rok Strniša
  • 6,781
  • 6
  • 41
  • 53
6

I tried the above, but had to do a bit more:

From above:

  • Remove GWT SDK from my project
  • Remove all GWT SDKs from eclipse
  • Download new GWT SDK (2.5.0)
  • Add it to eclipse and to my project

What I did extra:

  • Edit the .classpath file of my project
  • Move the classpathentry for GWT to just under 'src'
  • Save the .classpath file
  • Close the project
  • Open the project

And that did it for me. Moving it in the Build Path GUI did not seem to work for me!

So, the start of my .classpath ended up looking like this:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
    etc...
Jamie
  • 1,888
  • 1
  • 18
  • 21
5

In my case the GWT_CONTAINER was added below the JRE_CONTAINER. Fixing this manually within my .classpath file solved the problem!

<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
dfreis
  • 141
  • 1
  • 2
5

Project->Properties->Java Build Path, find GWT SDK in this list, click Edit.

  • If Use default SDK is checked make sure the default is available. If not, click Configure SDKs... and make sure you don't have an x symbol on your SDK. If so, remove it and re-add it.

  • If Use specific SDK is checked, make sure you've selected one that is available.

Chris Cashwell
  • 22,308
  • 13
  • 63
  • 94
  • This is what I normally do under point 2.; however, I like the clarity of your answer. – Rok Strniša Dec 16 '11 at 22:41
  • @Darthenius Unless you have a good reason not to, I'd set up the Default SDK to be whatever you intend to use, and use the `Use default SDK` option. That way you don't have to worry about it breaking in the future. – Chris Cashwell Dec 16 '11 at 23:21
2

Also an other soulutin is to move the GWT SDK to the top of the Library list(right after your project) on the Properties/Java Build Path/Order and Export page.

Cogur
  • 65
  • 7
0

You could use maven for compilation and setting up your workspace.

However I guess this would be overkill for you.

There is a Maven GWT Plugin.

Udo Held
  • 12,314
  • 11
  • 67
  • 93
  • This really is overkill for this specific question, though it's a good idea in the long run to employ a dependency management solution. – Chris Cashwell Dec 16 '11 at 22:22