-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Step 0 | 01:00 | Create a new maven-based Vaadin project using IntelliJ
- Loading branch information
Showing
8 changed files
with
329 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
contacts | ||
============== | ||
|
||
Template for a simple Vaadin application that only requires a Servlet 3.0 container to run. | ||
|
||
|
||
Workflow | ||
======== | ||
|
||
To compile the entire project, run "mvn install". | ||
|
||
To run the application, run "mvn jetty:run" and open http://localhost:8080/ . | ||
|
||
To produce a deployable production mode WAR: | ||
- change productionMode to true in the servlet class configuration (nested in the UI class) | ||
- run "mvn clean package" | ||
- test the war file with "mvn jetty:run-war" | ||
|
||
Client-Side compilation | ||
------------------------- | ||
|
||
The generated maven project is using an automatically generated widgetset by default. | ||
When you add a dependency that needs client-side compilation, the maven plugin will | ||
automatically generate it for you. Your own client-side customisations can be added into | ||
package "client". | ||
|
||
Debugging client side code | ||
- run "mvn vaadin:run-codeserver" on a separate console while the application is running | ||
- activate Super Dev Mode in the debug window of the application | ||
|
||
Developing a theme using the runtime compiler | ||
------------------------- | ||
|
||
When developing the theme, Vaadin can be configured to compile the SASS based | ||
theme at runtime in the server. This way you can just modify the scss files in | ||
your IDE and reload the browser to see changes. | ||
|
||
To use the runtime compilation, open pom.xml and comment out the compile-theme | ||
goal from vaadin-maven-plugin configuration. To remove a possibly existing | ||
pre-compiled theme, run "mvn clean package" once. | ||
|
||
When using the runtime compiler, running the application in the "run" mode | ||
(rather than in "debug" mode) can speed up consecutive theme compilations | ||
significantly. | ||
|
||
It is highly recommended to disable runtime compilation for production WAR files. | ||
|
||
Using Vaadin pre-releases | ||
------------------------- | ||
|
||
If Vaadin pre-releases are not enabled by default, use the Maven parameter | ||
"-P vaadin-prerelease" or change the activation default value of the profile in pom.xml . |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,173 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>org.vaadin.stepbystep</groupId> | ||
<artifactId>contacts</artifactId> | ||
<packaging>war</packaging> | ||
<version>1.0-SNAPSHOT</version> | ||
<name>contacts</name> | ||
|
||
<prerequisites> | ||
<maven>3</maven> | ||
</prerequisites> | ||
|
||
<properties> | ||
<vaadin.version>8.0.0</vaadin.version> | ||
<vaadin.plugin.version>8.0.0</vaadin.plugin.version> | ||
<jetty.plugin.version>9.3.9.v20160517</jetty.plugin.version> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<maven.compiler.source>1.8</maven.compiler.source> | ||
<maven.compiler.target>1.8</maven.compiler.target> | ||
<!-- If there are no local customisations, this can also be "fetch" or "cdn" --> | ||
<vaadin.widgetset.mode>local</vaadin.widgetset.mode> | ||
</properties> | ||
|
||
<repositories> | ||
<repository> | ||
<id>vaadin-addons</id> | ||
<url>http://maven.vaadin.com/vaadin-addons</url> | ||
</repository> | ||
</repositories> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.vaadin</groupId> | ||
<artifactId>vaadin-bom</artifactId> | ||
<version>${vaadin.version}</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>javax.servlet</groupId> | ||
<artifactId>javax.servlet-api</artifactId> | ||
<version>3.0.1</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.vaadin</groupId> | ||
<artifactId>vaadin-server</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.vaadin</groupId> | ||
<artifactId>vaadin-push</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.vaadin</groupId> | ||
<artifactId>vaadin-client-compiled</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.vaadin</groupId> | ||
<artifactId>vaadin-themes</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-war-plugin</artifactId> | ||
<version>3.0.0</version> | ||
<configuration> | ||
<failOnMissingWebXml>false</failOnMissingWebXml> | ||
<!-- Exclude an unnecessary file generated by the GWT compiler. --> | ||
<packagingExcludes>WEB-INF/classes/VAADIN/widgetsets/WEB-INF/**</packagingExcludes> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>com.vaadin</groupId> | ||
<artifactId>vaadin-maven-plugin</artifactId> | ||
<version>${vaadin.plugin.version}</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>update-theme</goal> | ||
<goal>update-widgetset</goal> | ||
<goal>compile</goal> | ||
<!-- Comment out compile-theme goal to use on-the-fly theme compilation --> | ||
<goal>compile-theme</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-clean-plugin</artifactId> | ||
<version>3.0.0</version> | ||
<!-- Clean up also any pre-compiled themes --> | ||
<configuration> | ||
<filesets> | ||
<fileset> | ||
<directory>src/main/webapp/VAADIN/themes</directory> | ||
<includes> | ||
<include>**/styles.css</include> | ||
<include>**/styles.scss.cache</include> | ||
</includes> | ||
</fileset> | ||
</filesets> | ||
</configuration> | ||
</plugin> | ||
|
||
<!-- The Jetty plugin allows us to easily test the development build by | ||
running jetty:run on the command line. --> | ||
<plugin> | ||
<groupId>org.eclipse.jetty</groupId> | ||
<artifactId>jetty-maven-plugin</artifactId> | ||
<version>${jetty.plugin.version}</version> | ||
<configuration> | ||
<scanIntervalSeconds>2</scanIntervalSeconds> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<profiles> | ||
<profile> | ||
<!-- Vaadin pre-release repositories --> | ||
<id>vaadin-prerelease</id> | ||
<activation> | ||
<activeByDefault>false</activeByDefault> | ||
</activation> | ||
|
||
<repositories> | ||
<repository> | ||
<id>vaadin-prereleases</id> | ||
<url>http://maven.vaadin.com/vaadin-prereleases</url> | ||
</repository> | ||
<repository> | ||
<id>vaadin-snapshots</id> | ||
<url>https://oss.sonatype.org/content/repositories/vaadin-snapshots/</url> | ||
<releases> | ||
<enabled>false</enabled> | ||
</releases> | ||
<snapshots> | ||
<enabled>true</enabled> | ||
</snapshots> | ||
</repository> | ||
</repositories> | ||
<pluginRepositories> | ||
<pluginRepository> | ||
<id>vaadin-prereleases</id> | ||
<url>http://maven.vaadin.com/vaadin-prereleases</url> | ||
</pluginRepository> | ||
<pluginRepository> | ||
<id>vaadin-snapshots</id> | ||
<url>https://oss.sonatype.org/content/repositories/vaadin-snapshots/</url> | ||
<releases> | ||
<enabled>false</enabled> | ||
</releases> | ||
<snapshots> | ||
<enabled>true</enabled> | ||
</snapshots> | ||
</pluginRepository> | ||
</pluginRepositories> | ||
</profile> | ||
</profiles> | ||
|
||
</project> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package org.vaadin.stepbystep; | ||
|
||
import javax.servlet.annotation.WebServlet; | ||
|
||
import com.vaadin.annotations.Theme; | ||
import com.vaadin.annotations.VaadinServletConfiguration; | ||
import com.vaadin.server.VaadinRequest; | ||
import com.vaadin.server.VaadinServlet; | ||
import com.vaadin.ui.Button; | ||
import com.vaadin.ui.Label; | ||
import com.vaadin.ui.TextField; | ||
import com.vaadin.ui.UI; | ||
import com.vaadin.ui.VerticalLayout; | ||
|
||
/** | ||
* This UI is the application entry point. A UI may either represent a browser window | ||
* (or tab) or some part of a html page where a Vaadin application is embedded. | ||
* <p> | ||
* The UI is initialized using {@link #init(VaadinRequest)}. This method is intended to be | ||
* overridden to add component to the user interface and initialize non-component functionality. | ||
*/ | ||
@Theme("mytheme") | ||
public class MyUI extends UI { | ||
|
||
@Override | ||
protected void init(VaadinRequest vaadinRequest) { | ||
final VerticalLayout layout = new VerticalLayout(); | ||
|
||
final TextField name = new TextField(); | ||
name.setCaption("Type your name here:"); | ||
|
||
Button button = new Button("Click Me"); | ||
button.addClickListener( e -> { | ||
layout.addComponent(new Label("Thanks " + name.getValue() | ||
+ ", it works!")); | ||
}); | ||
|
||
layout.addComponents(name, button); | ||
|
||
setContent(layout); | ||
} | ||
|
||
@WebServlet(urlPatterns = "/*", name = "MyUIServlet", asyncSupported = true) | ||
@VaadinServletConfiguration(ui = MyUI.class, productionMode = false) | ||
public static class MyUIServlet extends VaadinServlet { | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Please add your static resources here |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* This file is automatically managed and will be overwritten from time to time. */ | ||
/* Do not manually edit this file. */ | ||
|
||
/* Import and include this mixin into your project theme to include the addon themes */ | ||
@mixin addons { | ||
} | ||
|
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// If you edit this file you need to compile the theme. See README.md for details. | ||
|
||
// Global variable overrides. Must be declared before importing Valo. | ||
|
||
// Defines the plaintext font size, weight and family. Font size affects general component sizing. | ||
//$v-font-size: 16px; | ||
//$v-font-weight: 300; | ||
//$v-font-family: "Open Sans", sans-serif; | ||
|
||
// Defines the border used by all components. | ||
//$v-border: 1px solid (v-shade 0.7); | ||
//$v-border-radius: 4px; | ||
|
||
// Affects the color of some component elements, e.g Button, Panel title, etc | ||
//$v-background-color: hsl(210, 0%, 98%); | ||
// Affects the color of content areas, e.g Panel and Window content, TextField input etc | ||
//$v-app-background-color: $v-background-color; | ||
|
||
// Affects the visual appearance of all components | ||
//$v-gradient: v-linear 8%; | ||
//$v-bevel-depth: 30%; | ||
//$v-shadow-opacity: 5%; | ||
|
||
// Defines colors for indicating status (focus, success, failure) | ||
//$v-focus-color: valo-focus-color(); // Calculates a suitable color automatically | ||
//$v-friendly-color: #2c9720; | ||
//$v-error-indicator-color: #ed473b; | ||
|
||
// For more information, see: https://vaadin.com/book/-/page/themes.valo.html | ||
// Example variants can be copy/pasted from https://vaadin.com/wiki/-/wiki/Main/Valo+Examples | ||
|
||
@import "../valo/valo.scss"; | ||
|
||
@mixin mytheme { | ||
@include valo; | ||
|
||
// Insert your own theme rules here | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
@import "mytheme.scss"; | ||
@import "addons.scss"; | ||
|
||
// This file prefixes all rules with the theme name to avoid causing conflicts with other themes. | ||
// The actual styles should be defined in mytheme.scss | ||
|
||
.mytheme { | ||
@include addons; | ||
@include mytheme; | ||
|
||
} |