how do I force the compilation of a widgetset in Vaadin? - eclipse

I am trying to use the sparklines add on in my application. However, eclipse systematically refuses to compile the corresponding widgetset, i.e. if I specify the inherit tag in my widgetset that refers to the sparklines widgetset as follows:
<inherits name="org.vaadin.artur.icepush.IcepushaddonWidgetset" />
<inherits name="org.vaadin.hezamu.googlemapwidget.widgetset.GooglemapwidgetWidgetset" />
<inherits name="org.vaadin.sparklines.SparklinesWidgetset" />
<inherits name="com.fluxtream.widgets.FluxtreamwidgetsWidgetset" />
...eclipse complains with the following error:
Loading inherited module 'com.fluxtream.widgets.FluxtreamwidgetsWidgetset'
Loading inherited module 'com.fluxtream.dashboard.widgetset.FlxDashboardWidgetset'
Loading inherited module 'org.vaadin.sparklines.SparklinesWidgetset'
[ERROR] Unable to find 'org/vaadin/sparklines/SparklinesWidgetset.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
[ERROR] Line 26: Unexpected exception while processing element 'inherits'
However, I have verified that the widgetset was indeed declared as a dependency in my project's pom, and I have also verified that it appears under the "Maven Dependencies" library icon in the eclipse IDE.
Also, whenever I attempt to recompile my widgetset, and after the aforementioned error is displayed, I can see that my original widgetset.gwt.xml file has been modified, and as a result would look as follows:
<inherits name="org.vaadin.artur.icepush.IcepushaddonWidgetset" />
<inherits name="org.vaadin.hezamu.googlemapwidget.widgetset.GooglemapwidgetWidgetset" />
<inherits name="com.fluxtream.widgets.FluxtreamwidgetsWidgetset" />
<inherits name="com.fluxtream.dashboard.widgetset.FlxDashboardWidgetset" />
I'm really confused, as I don't understand what I am doing wrong. I am using other add-ons which work just fine (icepush and googlemap) and I really don't understand what I am doing wrong here.

The Vaadin Eclipse plugin manages your gwt.xml, that is why it is modifies if you add/remove add-on from classpath.
Basically this means that you don't have to modify the gwt.xml by hand, if working in Eclipse. Furthermore, the Eclipse plugin does not know anything about maven (or pom files) and any information in those does not affect to it.
You can compile the widgetset two ways. First with the Eclipse plugin (the button on toolbar) or with maven. This sounds that you are mixing those.
Easiest setup is to put all add-on jars to WEB-INF/lib and use the eclipse plugin to compile the widgetset. The gwt.xml should be automatically updated, but sometimes a refresh (or jar remove/add procedure) is needed to let the plugin notice change.
Also, check the Vaadin settings in project preferences are the way you want.

Related

Checkstyle Error in eclipse: cannot initialize module FilesFilter - Unable to instantiate FilesFilter

I am using checkstyle 5.7
I have written a custom FilesFilter as explained in the checkstyle documentation below,
http://checkstyle.sourceforge.net/writingfilters.html
As suggested in the documentation, I have written a java file and added an entry for it under "Checker" module in my config xml file.
So, this custom filter is supposed to ignore all files containing string "Test" in it's file name.
<module name="com.mycompany.myproject.filters.FilesFilter">
<property name="files" value="Test" />
</module>
Due to this entry in the config file, the check style is not loading in eclipse and gives following error,
cannot initialize module FilesFilter - Unable to instantiate
FilesFilter
Please help.
I think there is no straight solution for this yet. Or may be there is, if you are prepared to invest hours of your time.
Here's what I did as a workaround.
In eclipse, to disable checkstyles for a package (e.g. Test package in my case),
Go to, Project -> Properties -> Checkstyle
On Checkstyle Main tab, there is section "Exclude from checking.." with a set of check boxes.
Select the check box "files from packages:".
Click the "Change.." button in the right hand corner or just double click on "files from packages:"
Select the package you want Checkstyle to ignore. In my case I selected com/myproject/test/ package, and that was it. Checkstyle ignores all files in the test package.
If you are using Checkstyle as an ANT task, you may use excludes option as explained in the following code,
<target name="applyCheckStyle" depends="build" description="--> apply check style to all java files, excluding test package.">
<checkstyle config="${checkstyle.config}">
<fileset dir="${src.dir}" includes="**/*.java" excludes="**/test/**" />
<formatter type="plain" />
<formatter type="xml" toFile="${build.dir}/checkstyle_errors.xml" />
</checkstyle>
</target>
This worked for me :)

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 external jar in GWT

I have a jar file with source code packed.
i inserted the jar in war/WEB-INF/lib/xxx.jar Add to build path
but when i run the project i got an error
Edited Added gwt.xml
<module rename-to='bookmanagementsystem'>
<inherits name='com.google.gwt.user.User'/>
<inherits name='com.google.gwt.user.theme.standard.Standard'/>
<inherits name='com.example.Book'></inherits>
<entry-point class='com.example.Book.client.Index'/>
</module>
Edited
I solved
Plugin failed to connect to Development Mode server at 127.0.0.1:9997
Now i got a problem
Loading inherited module 'com.example.book'
[ERROR] Unable to find 'com/example/book.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
[ERROR] Line 6: Unexpected exception while processing element 'inherits'
If you want to include external jar to GWT then make sure you did the following
check the jar has .gwt.xml file and it must specify the source.
add it to lib folder
configure build path and add jar to libraries
select the jar from Order and Export
inherits this module in your .gwt.xml file
Eg. if you have a package in jar named "sample.source" and your .gwt.xml file in jar is "Source.gwt.xml" and this .gwt.xml file in "sample" folder and classes or entities in "source" folder
Then your current project must inherits it. ie it must have the following tag
<inherits name='sample.Source'/>
Eg :
Sorce.gwt.xml in jar file
<module>
<source path="">
<include name="**/MyEntity.java"/>
</source>
</module>
For reference :http://jonathan.lalou.free.fr/?p=1077
GWT is not supporting serialization in client side so try to use RPC and use these classes from jar in server or you just copy the packages of jar and add to src of gwt project.
OR
I solved the problem the jar files must have java source code along with class files or pack java source code into jar and use.

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?