summaryrefslogtreecommitdiffstats
path: root/documentation/clientside/clientside-compiling.asciidoc
blob: 962ff76a6ffce432e338b4fa60ef0d1c58e53723 (plain)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---
title: Compiling a Client-Side Module
order: 4
layout: page
---

[[clientside.compiling]]
= Compiling a Client-Side Module

A client-side module, either a widget set or a pure client-side module, needs to
be compiled to JavaScript using the Vaadin Client Compiler. During development,
the Development Mode makes the compilation automatically when you reload the
page, provided that the module has been initially compiled once with the
compiler.

As most Vaadin add-ons include widgets, widget set compilation is usually needed
when using add-ons. In that case, the widget sets from different add-ons are
compiled into a __project widget set__, as described in
<<dummy/../../../framework/addons/addons-overview.asciidoc#addons.overview,"Using Vaadin Add-ons">>.

////
TODO Provide a link to a proper add-on compilation section when one is
available.
////

[[clientside.compiling.overview]]
== Vaadin Compiler Overview

The Vaadin Client Compiler compiles Java to JavaScript. It is provided as the
[filename]#vaadin-client-compiler# JAR, which you can execute with the
[literal]#++-jar++# parameter for the Java runtime. It requires the
[filename]#vaadin-client# JAR, which contains the Vaadin client-side framework.

The compiler compiles a __client module__, which can be either a pure
client-side module or a Vaadin widget set, that is, the Vaadin Client-Side
Engine that includes the widgets used in the application. The client module is
defined with a module descriptor, which was described in
<<dummy/../../../framework/clientside/clientside-module#clientside.module,"Client-Side
Module Descriptor">>.

The compiler writes the compilation result to a target folder that will include
the compiled JavaScript with any static resources included in the module.


[[clientside.compiling.eclipse]]
== Compiling in Eclipse

When the Vaadin Plugin is installed in Eclipse, you can simply click the
[guibutton]#Compile Vaadin widgets# button in the toolbar. It will compile the
widget set it finds from the project. If the project has multiple widget sets,
such as one for custom widgets and another one for the project, you need to
select the module descriptor of the widget set to compile before clicking the
button.

The compilation with Vaadin Plugin for Eclipse currently requires that the
module descriptor has suffix [filename]#Widgetset.gwt.xml#, although you can use
it to compile also other client-side modules than widget sets. The result is
written under [filename]#WebContent/VAADIN/widgetsets# folder.


[[clientside.compiling.ant]]
== Compiling with Ant

You can find a script template for compiling widget sets with Ant and Ivy at the
link:http://vaadin.com/download/[Vaadin download page]. You can copy the build
script to your project and, once configured, run it with Ant.


[[clientside.compiling.maven]]
== Compiling with Maven

You can compile the widget set with the [literal]#++vaadin:compile++# goal as
follows:

[subs="normal"]
----
[prompt]#$# [command]#mvn# [parameter]#vaadin:compile#
----