GWT Main.gwt.xml file - gwt

I have a gwt project with the following directories:
-com.project
-com.project.client
-com.project.shared
-com.project.server
The gwt.xml config file is located in the com.project directory. What value should be in the
<source> tag for path?

Do you mean the tag for source with attribute path in the gwt.xml file? If that's the case, you use those paths for the translatable code (i.e., the code you want compiled from Java to JavaScript). Typically it's just the client and shared code that you want the GWT compiler to handle so you would set the following:
<source path='client' />
<source path='shared' />
If you were referring to another tag, please forgive me. :)

Related

Eclipse file template plugin doesn't use my template file

I am not really familliar with this topic but I want to create a plugin described at this page:
HowTo extend CDT with custom file templates.
So far as described in the Link I got it working. But in the example the template format is directly described in the <template>...</template>-Node:
// ${file_name}
// Test Source
But what I want to do is not to write my file template format into the XML-File of the plugin. Instead I want to have a file that is used with the file temlate, in my example H_Template.h. But I don't know how to include that file. Does anyone know?
I tried to use the attribute <include file="H_Template.h"/> with an relative path to the file from my plugin location. Or is it the relative path to my eclipse folder?
template.xml:
<templates>
<template name="Source template"
id="test.codetemplates.csourcefile"
description=" "
context="org.eclipse.cdt.core.cSource.contenttype_context"
enabled="true">
// ${file_name}
// Test Source
</template>
<template name="Header template"
id="test.codetemplates.headerfile"
description=" "
context="org.eclipse.cdt.core.cHeader.contenttype_context"
enabled="true">
<include file="H_Template.h"/> <!-- <<<<<<<< ??? -->
</template>
</templates>
H_Template.h:
// ${file_name}
// Test Header
There is no support for this. The template code must be included as part of the template.xml file.
The Eclipse code which reads the template is org.eclipse.jface.text.templates.persistence.TemplateReaderWriter.

GWT: CSS file defined in module definition file (gwt.xml) doesn't work?

From GWT tutorial (http://www.gwtproject.org/doc/latest/DevGuideUiCss.html), we know there are multiple approaches for associating CSS files with your module. Therein, one way is using the <stylesheet> element in the module XML file.
When I used the way to do it, I got the warning message below. It seems the way doesn't work.
Here's the contents of module1.gwt.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.7.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.7.0/distro-source/core/src/gwt-module.dtd">
<module rename-to="entry1">
<inherits name="com.google.gwt.user.User" />
<inherits name='com.google.gwt.user.theme.clean.Clean'/>
<source path="client" />
<entry-point class="com.jst.gwt2.client.Entry1"></entry-point>
<stylesheet src="../entry1.css" />
<source path='client' />
<source path='rpc' />
</module>
Here's the warning message:
GET /entry1.css
[WARN] ignored get request: /entry1.css
[WARN] not handled: /entry1.css
quoting #Thomas Broyer:
to get the full explanation click here
You'll have to change either
the path to your CSS (e.g. /entry1.css, but that won't necessarily work once deployed in production)
the location of your CSS (e.g. put it in your module's public path and reference it as <stylesheet src="entry1.css"/>)
the way you load it (e.g. inject it from your onModuleLoad, either as a StyleElement added to the Document; or possibly as a TextResource
that you inject using StyleInjector –and use one less request to the
server)

Build Path in eclipse

After importing my existing GWT project to Eclipse getting the following error.
Project 'TestUI' is missing required source folder: 'TestMgr/nocache/js.gwt.xml'.
Please help.
Please post your module gwt.xml. You should ensure the entry point classpath is correct
<!-- Specify the app entry point class. -->
<entry-point class="com.me.myproject.client.TestUI" />
And check that you added the appropriate packages to your module
<!-- Adding package to this gwt module -->
<source path="client" />
<source path="shared" />
If everything is fine with the module, could you be more specific about where that error happens ? When launching your project ? In Eclipse warnings ?

GWT Compiler cannot find Collect.gwt.xml, but I have Guava as a dependency

I'm moving over to a new computer, and in the processing I'm creating new Intellij 12 projects from my git source.
I have a gwt module file containing the following:
<!-- Other module inherits -->
<inherits name="com.google.common.collect.Collect" />
<inherits name="com.google.common.base.Base" />
<inherits name="com.bdl.message.Message" />
<inherits name="com.bdl.universal.Universal" />
<inherits name="com.bdl.appengine.AppEngine" />
<inherits name="com.bdl.gwt.BdlGwt" />
<inherits name="com.google.gwt.inject.Inject"/>
The com.bdl.* entries are from another library I've written and I have their jar files (and sources) in the module dependencies. I can confirm that removing those dependencies causes the corresponding inherits nameto turn red, indicating an error.
I also have as a dependency, a global library Guava (GWT) which contains:
classes:
guava-14.0-rc2.jar
sources:
guava-14.0-rc2-sources.jar
guava-gwt-14.0-rc2.jar
javadoc
guava-14.0-rc2-javadoc.jar
But despite this, the inherits for Collect and Base are red and the GWT compiler fails, saying it can't find Collect.gwt.xml.
On my old system I have an Intellij 11 project, which is set up the same way (there must be some difference somewhere, but I've been looking for hours to find it and can't)
That also has the same library as a dependency, and the inherits lines in my app's module are still red, but the GWT compiler succeeds, finding the Collect.gwt.xml right where it should be, at:
jar:file:/[path-to-guava]/guava-gwt-14.0-rc2.jar!/com/google/common/collect/Collect.gwt.xml
There must be something simple and stupid that I'm missing, but I can't find it.
You probably need to add guava-gwt-14.0-rc2.jar to your dependencies. Notice that the name has -gwt- embedded in it and you said that you have just these as dependencies:guava-14.0-rc2.jar sources: guava-14.0-rc2-sources.jar guava-gwt-14.0-rc2.jar javadoc guava-14.0-rc2-javadoc.jar
You can check that the jar is the appropriate one because when you open it (it is just a zip file) you should see the Collect.gwt.xml file somwhere within.

Adding jars to GWT project

this may be a stupid question but after 30minutes of Googleing, I still havent found an answer..
I want to build the example program "gwt-beans-binding" ( http://code.google.com/p/gwt-beans-binding/.
I download the *jar file and copied it into the the lib folder and added it to Properties-->Java Build Path -- >Libaries --> Add JARs.
When I'm build the project, I'm geting "java.lang.ClassNotFoundException"s...
What am I missing (do I have to write something in the *.gwt.xml?
For building inside Eclipse it should be enough with adding the library jar to the Libraries. But for GWT compiling (or executing inside Developer Mode) your module file (*.gwt.xml) has to point to the library module file. The library module file will say where the GWT source code is located.
<!-- this will declare where the source code is for the library GWT classes -->
<inherits name='org.gwt.beansbinding.Main' />
<!-- OR THIS... I don't really know -->
<inherits name='org.gwt.beansbinding.BeansBinding' />
The GWT compiler needs the sources to comile Java code to JavaScript. So you have to add the source folder to the class path too.
Can you give us the full stacktrace, what class is missing?