Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

WidgetSet compilation: my widgets not complied while external well.

John Rizzo
1 decade ago Apr 20, 2010 12:41pm
John Rizzo
1 decade ago Apr 20, 2010 12:50pm
Risto Yrjänä
1 decade ago Apr 20, 2010 1:53pm
Matti Tahvonen
1 decade ago Apr 20, 2010 2:03pm


gwt.xml file needs to be edited, but the task can be delegated to automatic helper that usually does the thing just fine. However, using it should not be necessary in your case. Do you have that server side class of the component also on GWT compilers class path?

Own entry points should not be needed anymore since 6.2, so you should remove that line.


John Rizzo
1 decade ago Apr 20, 2010 2:17pm
Artur Signell
1 decade ago Apr 20, 2010 2:55pm

John Rizzo: I just don't understand:
- where it is documented,

That would be Book of Vaadin, chapter 10.8.4 Compiling GWT Widget Sets

Notice that the server-side must be compiled before the client-side and the compiled server-side classes must be included in the class path for the GWT Compiler. The reason is that the annotations that define the component-to-widget mappings are read from the class files during the GWT compilation

John Rizzo: - why hell it worked before.

The mapping was previously done runtime using the old "tags" which needed to be specified for each component. As of 6.2.0 the mapping is generated compile time based on the @ClientWidget annotations (from the .class files)

John Rizzo
1 decade ago Apr 21, 2010 8:32am
Henri Sara
1 decade ago Apr 21, 2010 9:37am

John Rizzo: Note: if I omit modifying the gwt.xml file from my working situation, the compiler does not fine the component anymore.

Running the class com.vaadin.terminal.gwt.widgetsetutils.WidgetSetBuilder before the GWT compiler (with the same classpath as the GWT compiler) should update an already existing widgetset, adding/removing any required "inherits" statements.

If there no widgetset is found, one is created in the first directory (not JAR) on the classpath, so in this case having the project source directory first is a good idea.

John Rizzo
1 decade ago Apr 22, 2010 1:32pm

Oh, interesting Henri, thank you.

Let's recap: when I want to use a component from the add-on repository, I just
- download the jar and put it in my WEB-INF/lib directory
- run my Ant script (that will first create the gwt.xml file for my widgetset, then start the gwt compiler)

Here is my full Ant build file, in case a reader needs it in a few weeks/months (don't think the documentation one does everything I do):

<?xml version="1.0" encoding="UTF-8"?>

<project name="Widgetset Compiler" default="update-widgetset" basedir=".">
		To build client side GWT code into GWT compiled javascript (for our
		own Vaadin widgets)
	<property name="compilationOutput" value="${java.io.tmpdir}/widgetset" />

	<target name="compile-widgetset">
		<!-- Construct and check classpath -->
		<!-- Includes paths required for both server and client-side compilation -->
		<path id="compile.classpath">
			<pathelement location="${basedir}/src/main/java" />
			<pathelement location="${basedir}/WebRoot/WEB-INF/classes" />
			<pathelement location="${basedir}/externallib/gwt-dev.jar" />
			<pathelement location="${basedir}/externallib/gwt-user.jar" />
		    <fileset dir="${basedir}/WebRoot/WEB-INF/lib/">   <!-- vaadin-x.x.x.jar, RatingStars.jar, GoogleAnalyticsTracker.jar -->
		    	<include name="**/*.jar"/>
        <!-- Create the *.gwt.xml files -->	
		<java classname="com.vaadin.terminal.gwt.widgetsetutils.WidgetSetBuilder" failonerror="yes" fork="yes" maxmemory="600m">
	        <jvmarg value="-Xss8M" />
	        <jvmarg value="-Djava.awt.headless=true" />
			<arg value="blackbelt.ui.widgetset.BlackBeltWidgetset" />
				 <path refid="compile.classpath"/>

		<mkdir dir="${compilationOutput}" />

		<!-- Starts GWT compiler -->
		<java classname="com.google.gwt.dev.Compiler" failonerror="yes" fork="yes" maxmemory="600m">
	        <jvmarg value="-Xss8M" />
	        <jvmarg value="-Djava.awt.headless=true" />
			<arg value="-war" />
			<arg value="${compilationOutput}" />
			<arg value="blackbelt.ui.widgetset.BlackBeltWidgetset" />
				 <path refid="compile.classpath"/>
		<delete dir="${compilationOutput}/.gwt-tmp" includeemptydirs="true" />


	<!-- We need to play with the directories in order to not make SVN miserabily fail -->
	<target name="update-widgetset"   depends="compile-widgetset" >
		<!-- delete old widgetset files -->
		<delete includeemptydirs="true" failonerror="false">
			<fileset dir="./WebRoot/VAADIN/widgetsets/blackbelt.ui.widgetset.BlackBeltWidgetset"
				includes="**/*" excludes=".svn" />
		<!-- copy new widgetset files -->
		<copy todir="./WebRoot/VAADIN/widgetsets">
			<fileset dir="${compilationOutput}">
				<include name="**/*" />
				<exclude name="**/.*" />