Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
book-of-vaadin.pdf
Скачиваний:
88
Добавлен:
24.03.2015
Размер:
13.43 Mб
Скачать

Getting Started with Vaadin

Figure 2.7. Debugging a Vaadin Application

Above, we described how to debug a server-side application. Debugging client-side applications and widgets is described in Section 13.6, “Debugging Client-Side Code”.

2.6. Using Vaadin with Maven

Maven is a commonly used build and dependency management system. The Vaadin core library and all Vaadin add-ons are available through Maven.You can use a Maven with a front-end from Eclipse or NetBeans, or by using the command-line as described in this section.

In addition to regular Maven, you can use any Maven-compatible build or dependency management system, such as Ivy or Gradle. For Gradle, see the Gradle Vaadin Plugin [https://github.com/johndevs/gradle-vaadin-plugin]. Vaadin Plugin for Eclipse uses Ivy for resolving dependencies in Vaadin projects, and it should provide you with the basic Ivy configuration.

2.6.1. Working from Command-Line

You can create a new Maven project with the following command (given in one line):

$ mvn archetype:generate -DarchetypeGroupId=com.vaadin -DarchetypeArtifactId=vaadin-archetype-application

-DarchetypeVersion=7.x.x

-DgroupId=your.company

-DartifactId=project-name -Dversion=1.0 -Dpackaging=war

The parameters are as follows:

archetypeGroupId

The group ID of the archetype is com.vaadin for Vaadin archetypes.

46

Using Vaadin with Maven

Getting Started with Vaadin

archetypeArtifactId

The archetype ID. Vaadin 7 currently supports only the vaadin-archetype-application.

archetypeVersion

Version of the archetype to use. This should be LATEST for normal Vaadin releases. For prerelease versions it should be the exact version number, such as 7.0.0.beta3.

groupId

A Maven group ID for your project. It is used for the Java package name and should normally be your domain name reversed, such as com.example.myproject. The group ID is also used for the Java source package name of your project, so it should be Java compatible - only alphanumerics and an underscore.

artifactId

Identifier of the artifact, that is, your project. The identifier may contain alphanumerics, minus, and underscore.

version

Initial version number of your application. The number must obey the Maven version numbering format.

packaging

How will the project be packaged. It is normally war.

Creating a project can take a while as Maven fetches all the dependencies. The created project structure is shown in Figure 2.8, “A New Vaadin Project with Maven”.

Figure 2.8. A New Vaadin Project with Maven

2.6.2. Compiling and Running the Application

Before the application can be deployed, it must be compiled and packaged as a WAR package. You can do this with the package goal as follows:

$ mvn package

The location of the resulting WAR package should be displayed in the command output.You can then deploy it to your favorite application server.

Compiling and Running the Application

47

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]