- Create a new widget set definition file AppWidgetSet.gwt.xml in the grails-app/vaadin directory.This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.7.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/1.7.0/distro-source/core/src/gwt-module.dtd"> <module> <inherits name="com.vaadin.DefaultWidgetSet" /> <inherits name="com.example.YourWidgetset" /> </module> - Open VaadinConfig.groovy that is inside the grails-app/conf folder and add there a note about the new widgetset file.
widgetset = "app.AppWidgetSet" - Create a folder libs-widgetset (for example inside the project root folder) for libraries that are needed during the widget set compilation. Download all-in-one archive of Vaadin 7 from https://vaadin.com/download and move all the .jar files from the archive into libs-widgetset folder. Do not forgot to move also .jar files from lib folder from the archive.
- Create build.xml file with the following content.This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
<?xml version="1.0"?> <project name="Widgetset compiler" basedir="." default="compile-widgetset"> <target name="compile-widgetset"> <path id="classpath"> <pathelement path="grails-app/vaadin"/> <pathelement path="src/java"/> <pathelement path="target/classes"/> <fileset dir="libs-widgetset"> <include name="*.jar"/> </fileset> </path> <echo>Compiling ${widgetset}...</echo> <property name="module" value="app.AppWidgetSet" /> <property name="module.output.dir" location="web-app/VAADIN/widgetsets" /> <property name="localWorkers" value="2" /> <mkdir dir="${module.output.dir}" /> <java classname="com.google.gwt.dev.Compiler" classpathref="classpath" failonerror="yes" fork="yes" maxmemory="512m"> <arg value="-war" /> <arg value="${module.output.dir}" /> <arg value="-localWorkers" /> <arg value="${localWorkers}" /> <arg value="-strict" /> <arg value="${module}" /> <sysproperty key="vFailIfNotSerializable" value="true" /> <jvmarg value="-Xss8M" /> <jvmarg value="-XX:MaxPermSize=256M" /> <jvmarg value="-Djava.awt.headless=true" /> </java> </target> </project> - Open the console inside the project root and run the ant command. The widget set compilation will start. Before you run the ant command, remove all the content of vaadin-grails-addon/web-app/VAADIN folder.
Monday, June 3, 2013
Vaadin 7 and Grails: How to compile widget set
I have promised to publish a tutorial showing how to compile the widget set inside Grails project with Vaadin 7. Here you are.
Subscribe to:
Post Comments (Atom)
Excellent article. I bought the book, needed to implement projects with Vaadin and Grails.
ReplyDeleteHi, I tried this for Contextmenu as per Vaadin 7 Cookbook. The twist is I'm also using Vaadin on Grails (with the book also). Did compile the widgetset and it works, but without its theme. So what I get is a context menu, with labels only, no theme. Any ideas on this?
ReplyDelete