Hi,
I’m trying to compile a widgetset for vaadin 7.5.7 wihtout using the eclipse plugin. To do that I use the ant script from here: https://vaadin.com/download/misc/build-widgetset.xml
First problem is that the ant script above is not compatible to Vaadin 7.5.7. I have adjust the script to
<?xml version="1.0"?>
<!--
Client-side code is compiled by using GWTCompiler which compiles client-side Java code into
JavaScript. Generated files are located under WebContent/VAADIN/widgetsets/*.
Client-side compilation is required if you create new or modify existing widgets.
You may use either this script or Vaadin Hosted Mode Browser.launch (in Eclipse)
to compile your client-side java code.
By default Vaadin first tries to serve widgetset resources from the file system, if that
fails then files are streamed from vaadin-@version@.jar.
See configure target to adjust this buildfile.
-->
<project name="Widgetset compile example" basedir="." default="compile-widgetset">
<!--
Update based on your project structure, by default this buildfile assumes that you
1. use WebContent under your project's root directory
2. WebContent/WEB-INF/lib/vaadin-@version@.jar exists
3. WebContent/WEB-INF/src contains your project source files
4. gwt directory contains extracted GWT distribution
-->
<target name="configure">
<!-- Path from this file to the project root -->
<property name="base"
value="./" />
<!-- Location of GWT distribution -->
<property name="gwt-location"
value="${base}/WebContent/WEB-INF/lib/vaadin-client-compiler-@version@.jar" />
<property name="ant-jar-location"
value="${base}/extLib/antExt/vaadin/ant-1.6.5.jar" />
<!-- Location of Vaadin JAR -->
<property name="vaadin-jar-location"
value="${base}WebContent/WEB-INF/lib/vaadin-@version@.jar" />
<!-- Location of project source code -->
<property name="src-location"
value="${base}/src" />
<!-- Target where to compile server-side classes -->
<property name="server-side-destination"
value="${base}/build/classes"/>
<!-- Target where to compile the widget set -->
<property name="client-side-destination"
value="${base}WebContent/VAADIN/widgetsets" />
</target>
<!-- NOTE: Modify this example to compile your own widgetset -->
<target name="configure-widgetset">
<echo>Modify this example Ant script to compile your own widget sets.</echo>
<!-- Name of the widget set -->
<property name="widgetset" value="com.xyz.vaadin.widgetset.XyzvaadinWidgetset"/>
<!-- Define if the widget set be generated automatically -->
<!-- from all widget sets included in the class path. -->
<!-- <property name="generate.widgetset" value="1"/> -->
<!-- Path to the widgetset directory. Required only for -->
<!-- generated widget sets. Must be relative to -->
<!-- $src-location, that is, under the first entry in -->
<!-- class path. -->
<property name="widgetset-path"
value="XyzVaadin.VAADIN/com.xyz.vaadin.widgetset.XyzvaadinWidgetset/"/>
</target>
<!-- Note: Modify this example to compile your own widgetset Jar. -->
<target name="configure-jar">
<!-- The compiled JAR name -->
<property name="jar-destination" value="${base}colorpicker.jar"/>
<!-- Title of the widget set (for JAR) -->
<property name="widgetset-title" value="ColorPicker"/>
<!-- Version of the widget set (for JAR) -->
<property name="widgetset-version" value="1.0"/>
<!-- Vendor of the widget set (for JAR) -->
<property name="widgetset-vendor" value="IT Mill Oy"/>
</target>
<!-- ================================================== -->
<!-- Build Targets -->
<!-- ================================================== -->
<target name="init" depends="configure">
<echo>Requirements for classpath:</echo>
<echo> ${gwt-location}</echo>
<!-- echo> ${gwt-location}/validation-api-1.0.0.GA.jar.save</echo>
<echo> ${gwt-location}/validation-api-1.0.0.GA-sources.jar.save</echo -->
<echo> ${ant-jar-location}</echo>
<echo> ${vaadin-jar-location}</echo>
<echo> ${src-location}</echo>
<echo>Output will be written into ${client-side-destination}</echo>
<!-- Check that files exist -->
<fail message="Some of the required files (listed above) are missing.">
<condition>
<not>
<resourcecount count="3">
<!-- filelist
files="${gwt-location}/gwt-dev.jar.save,${gwt-location}/gwt-user.jar.save,${gwt-location}/validation-api-1.0.0.GA.jar.save,${gwt-location}/validation-api-1.0.0.GA-sources.jar.save,${vaadin-jar-location},${ant-jar-location}"/ -->
<filelist
files="${gwt-location},${vaadin-jar-location},${ant-jar-location}"/>
</resourcecount>
</not>
</condition>
</fail>
<!-- Construct and check classpath -->
<!-- Includes paths required for both server and client-side compilation -->
<path id="compile.classpath">
<!-- The source location must be first, as required by generate-widgetset. -->
<pathelement path="${src-location}"/>
<pathelement path="${server-side-destination}"/>
<pathelement path="${vaadin-jar-location}"/>
<pathelement path="${ant-jar-location}"/>
<pathelement path="${gwt-location}"/>
<!-- pathelement path="${gwt-location}/validation-api-1.0.0.GA.jar.save"/>
<pathelement path="${gwt-location}/validation-api-1.0.0.GA-sources.jar.save"/ -->
<fileset dir="${base}WebContent/WEB-INF/lib/">
<include name="*.jar"/>
</fileset>
</path>
</target>
<!-- Compiled server-side components are needed for building the client-side -->
<target name="compile-server-side" depends="init">
<javac srcdir="${src-location}" destdir="${server-side-destination}">
<classpath>
<path refid="compile.classpath"/>
</classpath>
</javac>
</target>
<!-- Generates a combined widget set from all widget -->
<!-- sets in the class path, including project sources. -->
<!-- Updates the configuration if it already exists. -->
<target name="generate-widgetset" depends="compile-server-side, configure-widgetset" if="generate.widgetset">
<!-- Create the directory if it does not already exist. -->
<mkdir dir="${src-location}/${widgetset-path}"/>
<java classname="com.vaadin.terminal.gwt.widgetsetutils.WidgetSetBuilder"
failonerror="yes" fork="yes" maxmemory="256m"><arg value="${widgetset}"/>
<jvmarg value="-Xss1024k"/>
<jvmarg value="-Djava.awt.headless=true"/>
<classpath>
<path refid="compile.classpath"/>
</classpath>
</java>
</target>
<!-- Build the widget set. -->
<target name="compile-widgetset" depends="compile-server-side, generate-widgetset">
<echo>Compiling ${widgetset}...</echo>
<java classname="com.google.gwt.dev.Compiler" failonerror="yes" fork="yes" maxmemory="256m">
<arg value="-war"/>
<arg value="${client-side-destination}"/>
<arg value="${widgetset}"/>
<jvmarg value="-Xss1024k"/>
<jvmarg value="-Djava.awt.headless=true"/>
<classpath>
<path refid="compile.classpath"/>
</classpath>
</java>
</target>
<!-- Build JAR -->
<target name="package-jar" depends="init, configure-widgetset, configure-jar">
<jar jarfile="${jar-destination}" compress="true">
<manifest>
<attribute name="Vaadin-Package-Version" value="1"/>
<attribute name="Vaadin-Widgetsets" value="${widgetset}"/>
<attribute name="Implementation-Title" value="${widgetset-title}"/>
<attribute name="Implementation-Version" value="${widgetset-version}"/>
<attribute name="Implementation-Vendor" value="${widgetset-vendor}"/>
<!-- The following are Vaadin-specific. -->
<attribute name="Vaadin-License-Title" value="Apache2"/>
<attribute name="Vaadin-License-File" value="http://www.apache.org/licenses/LICENSE-2.0"/>
</manifest>
<!-- The built server-side classes are here. -->
<fileset dir="${server-side-destination}">
<patternset>
<include name="**/*"/>
</patternset>
</fileset>
<!-- Especially all the widget set source files are required.-->
<fileset dir="${src-location}">
<patternset>
<include name="**/*"/>
</patternset>
</fileset>
</jar>
</target>
</project>
The libraries used by the ant script are:
- vaadin-*-7.5.7.jar
- ant-1.6.5.jar
But if I run the script I get following exception:
at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:50)
at com.google.gwt.dev.Compiler.main(Compiler.java:127)
Caused by: java.lang.ClassNotFoundException: com.google.gwt.core.ext.GeneratorExt
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 139 more
But I cannot find the GeneratorExt class in any jar file of Vaadin 7.5.7. Anybody knows whats wrong or missing? Is there anywhere a tutorial how I can compile a widgetset for Vaadin 7.5/7.6 “by hand” (means: without using the eclipse plugin)?
Thanks,
Steffen
EDIT
Same result by using following command line call:
java -classpath vaadin-client-compiler-7.5.7.jar:guava-16.0.1.vaadin1.jar:../../../src:gwt-user.jar:vaadin-widgets-7.5.7.jar:ant-1.6.5.jar com.google.gwt.dev.Compiler -war ../../VAADIN/widgetsets com.xyz.vaadin.widgetset.XyzvaadinWidgetset