How to compile my widget ?

Hello,

I am a new user of Vaadin, and I would like to know how I can compile my widget.

The main problem, is that I am not using my project as an Vaadin project (in eclipse) but as a
normal
maven project.

I have a main which instanciate a Grizzly container like that :

public static void main(String args[])
	{
		GrizzlyWebServer grizzly = new GrizzlyWebServer(18081);

		ServletAdapter sa = new ServletAdapter();
		sa.setServletInstance(new com.vaadin.terminal.gwt.server.ApplicationServlet());
		sa.addContextParameter("productionMode", "false");
		sa.setContextPath("/");
		sa.setProperty(ServletAdapter.LOAD_ON_STARTUP, "1");
		sa.addInitParameter("application", FIVApplication.class.getName());
		grizzly.addGrizzlyAdapter(sa, new String[]
		{
			"/", "/VAADIN"
		});
		
		FIVPersistenceHelper.getInstance().init();

		try
		{
			grizzly.start();
		}
		catch(IOException e)
		{
			e.printStackTrace();
		}
	}

This is really powerfull, as I can embed my application in any normal java application.

The problem, is that eclipse don’t auto detect the fact I have added an addon (refresher), and I didn’t succeed to use the
mvn vaadin:update-widgset install
.

How can I make addons works in my special way to use Vaadin ?

Thanks for all, and happy new year.

I haven’t played that much with Maven myself so all I can do is to point to a wiki article and a specific line in it:


Wiki: Using Maven with Vaadin

Have you tried the gwt:compile?

Thanks Jens !

Here is why I didn’t succedd at first : my pom.xml file didn’t have the good plugins section for vaadin:update-widgetset command and neither for gwt:compile.

After finding that, I had an other problem : because I am using Vaadin v6.7.2, what are the version of theses plugins ?

So here is my build section :

<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>2.3.2</version>
				<configuration>
					<source>1.6</source>
					<target>1.6</target>
				</configuration>
			</plugin>

			<!-- Compiles your custom GWT components with the GWT compiler -->
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>gwt-maven-plugin</artifactId>
				<version>2.3.0</version>
				<configuration>
					<webappDirectory>src/main/resources/VAADIN/widgetsets</webappDirectory>
					<extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
					<runTarget>vaadin-mvn-addon</runTarget>
					<soyc>false</soyc>
				</configuration>
			</plugin>
			<!-- Updates Vaadin 6.2+ widgetset definitions based on project dependencies -->
			<plugin>
				<groupId>com.vaadin</groupId>
				<artifactId>vaadin-maven-plugin</artifactId>
				<version>1.0.2</version>
			</plugin>
		</plugins>
	</build>

I don’t use the execution parameters because I don’t want it to be executed for each compilation, I have a little script, that I instantiate myself : mvn vaadin:update-widgetset gwt:compile

And finally, my last problem was that I don’t have a web.xml file, nor webapps folder, because of the instanciation of grizzly.

I had to add the sa.addInitParameter("widgetset", "com.fiv.CustomWidgetSet"); in the code I provided earlier.

I created a
com.fiv.CustomWidgetSet.gwt.xml
file in the resources folder of my maven project with the normal content :

<?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.terminal.gwt.DefaultWidgetSet" />

	<inherits name="com.github.wolfie.refresher.RefresherApplicationWidgetset" />
</module>

Everything works well now !

Great and thank you.