Vaadin is a fancy JAVA Ajax Web Frame­work. I had some trou­bles set­ting up maven2, thats why I cre­ated a quick howto:

1) Down­load and install Vaadin Add-on’s
Get the Google Map Add-on from the Vaadin Direc­tory and expand the .zip file. Install the pack­age into your repo, for example:

1
2
mvn install:install-file –Dfile=googlemapwidget-0.9.3.jar –DgroupId=org.vaadin.hezamu –Dar­ti­fac­tId=googlemap­wid­get –Dpack­ag­ing=jar –Dver­sion=0.9.3
mvn install:install-file –Dfile=gwt-maps.jar –DgroupId=com.google.gwt.maps –Dar­ti­fac­tId=gwt-maps –Dpack­ag­ing=jar –Dver­sion=1.0.4

2) Cre­ate a new maven project
Cre­ate a new sam­ple project, for more infor­ma­tion check out the Wiki.

1
mvn archetype:generate –Dar­che­type­GroupId=com.vaadin –Dar­che­ty­peArti­fac­tId=vaadin-archetype-sample –Dar­che­type­V­er­sion=LATEST –DgroupId=com.neophob  –Dar­ti­fac­tId=project-name –Dver­sion=1.0 –Dpack­ag­ing=war

Check http://mvnrepository.com/artifact/com.vaadin/vaadin-archetype-sample for the lat­est vaadin archetype!

3) Edit pom.xml
Make sure the gwt-maven-plugin use at least the 1.3-SNAPSHOT ver­sion. The next step is to add the Add-on dependencies:

1
2
3
4
5
6
7
8
9
10
<depen­dency>
  <groupId>com.google.gwt.maps</groupId>
  <arti­fac­tId>gwt-maps</arti­fac­tId>
  <ver­sion>1.0.4</ver­sion>
</depen­dency>
<depen­dency>
  <groupId>org.vaadin.hezamu</groupId>
  <arti­fac­tId>googlemap­wid­get</arti­fac­tId>
  <ver­sion>0.9.3</ver­sion>
</depen­dency>

4) Copy GWT dec­la­ra­tions
Copy the files GooglemapwidgetWidgetset.gwt.xml, AjaxLoader.gwt.xml and GoogleMaps.gwt.xml (those xml files are inside the plu­gin jar file) to the src­main­java­com­neo­phobgwt directory.

5) Declare Wid­get­set
Edit web.xml, add ref­er­ence to Widgets:

1
2
3
4
5
6
7
8
9
10
11
<servlet>

  <init-param>
    <param-name>wid­get­set</param-name>
    <param-value>com.neophob.gwt.GoogleMaps</param-value>
  </init-param>
  <init-param>
    <param-name>wid­get­set</param-name>
    <param-value>com.neophob.gwt.GooglemapwidgetWidgetset</param-value>
  </init-param>
</servlet>

6) Cre­ate Sim­ple Class
Edit ColorPickerAppliaction.java, replace the it with this content:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
pack­age com.neophob;

import java.awt.geom.Point2D;
import org.vaadin.hezamu.googlemapwidget.GoogleMap;
import org.vaadin.hezamu.googlemapwidget.overlay.BasicMarker;
import com.vaadin.ui.Label;
import com.vaadin.ui.Window;

pub­lic class Col­or­Pick­er­Ap­pli­ca­tion extends com.vaadin.Appli­ca­tion {

  @Override
  pub­lic void init() {
    Win­dow main­Win­dow = new Win­dow(“Example_ide Appli­ca­tion”);
    Label label = new Label(“Hello Vaadin uservvvv”);
    main­Win­dow.add­Com­po­nent(label);
    set­Main­Win­dow(main­Win­dow);

    // Cre­ate a new map instance cen­tered on the IT Mill offices
    GoogleMap googleMap = new GoogleMap(this, new Point2D.Dou­ble(22.3, 60.4522), 8);
    googleMap.setWidth(“640px”);
    googleMap.setHeight(“480px”);

    // Cre­ate a marker at the IT Mill offices
    googleMap.addMarker(new Basic­Marker(1L, new Point2D.Dou­ble(22.3, 60.4522), “Test marker”));

    main­Win­dow.add­Com­po­nent(googleMap);
  }
}

7) Run Jetty

1
> mvn jetty:run

Fire up your browser:

Other use­fulll maven targets:

1
2
3
4
update wid­get­sets:
# mvn vaadin:update-widgetset
recre­ate javascript:
# mvn gwt:clean gwt:compile